Tags: java swing

only one swing frame window opened at time

Tags: ,

I developed one swing application but each time you run application new window is opened. I want that if one window is already opened other not allow to open.


How do I use WS-Addressing properly in an Axis2 client?

All, I’m attempting to write a Junit test that calls a Web Service client in Axis2.1.5, and I’ve gotten confused about how to exactly to set it up to use WS-Addressing. I’ve generated a client stub …


Map equality using Hamcrest

I’d like to use hamcrest to assert that two maps are equal, i.e. they have the same set of keys pointing to the same values. My current best guess is: assertThat( affA.entrySet(), hasItems( affB….

Is using “\\” to match ” with Regex in Java the most Readable Way?

Tags: , ,

I know that the following works but it is not that readable, is there any way to make it more readable in the code itself without the addition of a comment? //Start her off String sampleregex = “\\”…


Dynamically formatting a string

Before I wander off and roll my own I was wondering if anyone knows of a way to do the following sort of thing… Currently I am using MessageFormat to create some strings. I now have the …


Android Reading from an Input stream efficiently

I am making an HTTP get request to a website for an android application I am making. I am using a DefaultHttpClient and using HttpGet to issue the request. I get the entity response and from this …


How can I do LZW decoding in Java?

I have a database which contains picture data stored as a binary blob. The documentation says the data is encoded using LZW. I thought that I could decode it using the Zip or GZip input streams found …


make a JLabel wrap it’s text by setting a max width

I have a JLabel which has a lot of text on it. Is there a way to make the JLabel have a max width so that it will wrap the text to make it not exceed this width? Thanks

Should Enterprise Java entities be dumb?

Tags: , , ,

In our legacy Java EE application, there are loads of value object (VO) classes which typically contain only getters and setters, maybe equals() and hashCode(). These are (typically) the entities to …

Why doesn’t String’s hashCode() cache 0?

Tags: , ,

I noticed in the Java 6 source code for String that hashCode only caches values other than 0. The difference in performance is exhibited by the following snippet: public class Main{ static void …