Skip to content

JUnit Tests for GUI in Java

I would like to write test cases for a GUI. I want to know how do you simulate a click of JButton, or how do you extract the elements of a JTable. For the purpose of this, I have built a simple GUI that increase the count by 1 if the button is clicked and the JTextfield is empty, but

Glassfish unable to deploy at root because default-web-module is declared

While trying to deploy to Glassfish Server Open Source Edition (build 5) from both Netbeans and Admin Console the following message is thrown. Eventhough the Applications section of the Admin Console has no deployed applications. I have tried restarting the domain without success. Exception while loading the app : java.lang.Exception: WEB0145: Unable to deploy web module [*module name*] at

How to use named parameter in plain sql with jooq

I’m using JOOQ with plain/raw SQL, so that means i’m not using any code generation or the fluid DSL thingy. The following code works: Connection connection = …; DSLContext context = DSL.using(…

Switch listener in ListView giving wrong results

Here is my Array adapter. It assigns each switch button in the list with a listener that is dependant on the id given by the database (passed using But for some reason, the switch …

Does .asSet(…) exist in any API?

I’m looking for a very simple way to create a Set. Arrays.asList(“a”, “b” …) creates a List Is there anything similar for Set ?

Resize a picture to fit a JLabel

I’m trying to make a picture fit a JLabel. I wish to reduce the picture dimensions to something more appropriate for my Swing JPanel. I tried with setPreferredSize but it doesn’t work. I’m …

Eclipse plugin dev, how to stop HttpsURLConnection of poping up user/password window when I connect

JDK IBM 1.6 Eclipse 3.6.2 Connect to a server with following code. URL urlTemplate = new URL(uri); uc = (HttpURLConnection) urlTemplate.openConnection(); when connecting with wrong credential, it will pop up a window to enter correct credential as input, how to stop it? it seems to be built-in action and unable to stop that build-in functionality. Another issue is that, when