java

setDataVector - javax.swing.Table

i had a situation where i had to use this setDataVector function. I was puzzled to see there was an extra second argument(Vector columnIdentifiers) in the function. I'm just resetting the data. Why do i need to send the column identifiers?? And it doesn't take the old column identifiers by default if i don't pass the second argument. Irr...

Java Library and Class Path Problems

Quick personal background: I was hired a few months ago as the sole .NET developer (C#) by a company whose other devs are all php devs. A week into the job I was told they wanted to switch to Java instead of doing .NET. Not an ideal situation, but I'm trying to make it work. I don't think I understand the relation between a project's li...

Hibernate Validator Exceptions

I'm using Hibernate Validator in an application with EJB and Spring MVC. I'm using JBoss 5, Hibernate 3 and Spring MVC version 3. I'd like to try and catch validation exceptions at Spring Exception Resolver level and generate an error message based on the InvalidStateException message. I don't want to put exception handling logic in t...

Joda Time to be included in Java 7?

I've read rumors that Joda Time is slated to be included in Java 7, but am having trouble locating a definitive source for this information. Will Joda Time be included in a future JDK? Please cite your source. ...

Java interface static method workaround?

We have a given REST interface: POST /calculation <data>abc</data> This calculation can be implemented by different logical "calculators" depending on the server config. We are now designing the Java interface that each calculator must implement. The interface will have a method for each REST service. Given that all REST (and H...

Download a directory over HTTP in Java

I have some files in a directory tree which is being served over HTTP. Given some sub-directory A, in that directory tree I want to be able to download directory A and all containing subdirectories and files. It seems likely that a simple/direct/atomic solution exists in the some dark corner of Java. Does anyone know how to do this? ...

Inserting Username token in security header of already generated SOAP envelope gives me two headers!

I'm using WSS4J to add a Username token in the header of an already formed SOAP request envelope. Here is what the SOAP request looks like: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://sample03.samples.rampart.apache.org/xsd"&gt; <soapenv:Header/> <soapenv:Body> ...

Java data transfer object naming convention?

Given this scenario where you have "transfer objects" (POJO's with just getters/setters) which are passed by a client library to your API, what is the best way to name the transfer objects? package com.x.core; public class Car { private String make; private String model; public Car(com.x.clientapi.Car car) { ...

MATLAB: Getting an array of cells from MATLAB to Java

I have an array created in MATLAB that contains a number of cell type objects which contain arrays of doubles. It's basically a <1xn cell> array and each cell is an array of doubles. What I want to do is to somehow export these so that I can then insert the data into Java as a ragged array of arrays of type int. Any thought on how to b...

How do you put a subclass method into a superclasses JLabel?

So here's the class and the super class, question to follow: TestDraw: package project3; import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JLabel; public class TestDraw extends MyShape { public static void main(String[] args) { DrawPanel panel = new DrawPanel(); JFrame application = new JF...

What is the JDBC equivalent to query an IBM Domino data store?

I need to query an IBM Domino data store that was populated using Lotus Notes from within a Java application. I am hoping that IBM followed the JDBC design pattern so that I can implement similarly to what I have done to get data from Oracle. Where should I start? I am aware that IBM does not support JDBC for Domino. What I need is...

Can't Run JAR Files

I can run my project through netbeans but after I make a jar file and double click it I get the error cannot find Java runtime environment? I am on Windows. ...

Jetty vs CXF / Which one to choose?

Hi, I am fairly new to the Java world and pretty overwhelmed by the beauty of choice between dozens of libraries doing more or less the same thing, or not. So with Jetty and CXF. I am looking for a web services stack that has built-in support for a wide range of transports and protocols. I was under the impression that CXF is the more...

Federated Identity Management

I'm looking for a way to pull user (eg. inetOrgPerson) information in a federated way. For the most part, this information will come from LDAP but could come from secondary systems. I've looked at things like Jasig's Person Directory (married to Spring and we don't use it) and ArisID (no examples of use, yet). I'm working inside of OS...

Using Java and its SWING library.

I am trying to code a very simple form using java but i am running into more trouble than i expected because of the way swing lays out components, I have tried various different layout managers and still cannot layout the form the way i would like. Here is how i would like the form to look: link text Does anyone have any ideas about h...

What is the difference between these two ways of casting in Java?

What is the difference between these two ways of casting in Java? (CastingClass) objectToCast; CastingClass.class.cast(objectToCast); The source of Class#cast(Object) is as follows: public T cast(Object obj) { if (obj != null && !isInstance(obj)) throw new ClassCastException(); return (T) obj; } So, cast is basically a generic...

Launching jEdit From Java Swing App Using Runtime.getRuntime().exec()

I'm writing a Java Swing Application running on Red Hat Enterprise Linux 5 server that I would like to launch jEdit to view log files. Here is some example code. public static void main(String[] args) throws IOException, InterruptedException { String cmd = "sh -c \"java -jar /tmp/jEdit/jedit.jar /tmp/test.txt\""; System.out.p...

is it possible to do this on a input type ="file"?

I need to pass the filename of a file-input to a parent page... is this even possible? The input type ="file" has a value, but can I use it like this? I have used the value of the file-input to check the extension of the file, and it works! So I guess there is a value, but can this be done and is it reliable? If not, how would you hav...

Problem with mouseListener on JPanel

Hi, I have problem with mouseListener in JPanel. I add JLabel which contain image(size 600 x 600) on JPanel, and I add mouseListener for the JPanel. Everytimes I click on the image, the image should change to another image, and this is working fine. However, the problem is that, only if I click on the right side or at the center of the ...

finding similar colors programatically

I have a buffered image in java and I want to record how similar each pixel is to another based on the color value. so the pixels with 'similar' colors will have a higher similarity value. for example red and pink will have a similarity value 1000 but red and blue will have something like 300 or less. how can I do this. when I get the R...