Is it possible to make a JFrame that has a transparent background and draw an image on it, so only the image will be visible with no border or background? Answer See Translucent and Shaped Swing Windows by Kirill Grouchnikov.
only one swing frame window opened at time
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. Answer Here is an example of a Java Single Application Instance: A single instance application is one that only allows for 1 of the application to run …
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 using wsdl2java, and I’m using the axis2.xml and modules repository from the axis2 binar…
How to get Locale from its String representation in Java?
Is there a neat way of getting a Locale instance from its “programmatic name” as returned by Locale’s toString() method? An obvious and ugly solution would be parsing the String and then constructing a new Locale instance according to that, but maybe there’s a better way / ready soluti…
singleton pattern in java. lazy initialization
1.is there a flaw with the above implementation of the getInstance method? 2.What is the difference between the two implementations.? I have seen a lot of answers on the singleton pattern in stackoverflow but the question I have posted is to know mainly difference of ‘synchronize’ at method and bl…
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: which gives: The method assertThat(T, Matcher<T>) in the type Assert is not applicable for the arguments (Set<Map.Entry<Householdtypes,Double…
Is using “\\” to match ” with Regex in Java the most Readable Way?
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 requirement that some of those strings will have a variable number of arguments. For example (current code): Now I nee…
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 obtain an InputStream object for getting the html of the page. I then cycle through the reply doing as follows: Ho…
what databases can be used with java?
I am doing an undergrad final project, and need to justify my choice of MySQL for the database element of my project. Truth is, it’s the only one I can really use, and hence I went for it. What other database systems could I have used? Any advantages and disadvantages of these over MySQL? Answer In fact…