I made a simple Swing application. But the rendering behaves buggy. Have I done anything wrong or is it a bug?
It’s simple a small JFrame with a textfield, button and an empty list. If I first resizes the window horizontally and then type in the textfield, the button suddenly disappear.
Here is my code:
public class App extends JFrame {
public App() {
JTextField messageFld = new JTextField();
JButton saveBtn = new JButton("Save");
JPanel inputPanel = new JPanel(new BorderLayout());
inputPanel.add(messageFld, BorderLayout.CENTER);
inputPanel.add(saveBtn, BorderLayout.EAST);
JList<Data> list = new JList<Data>();
JPanel panel = new JPanel(new BorderLayout());
panel.add(inputPanel, BorderLayout.NORTH);
panel.add(list, BorderLayout.CENTER);
this.getContentPane().add(panel);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("Test application");
this.pack();
this.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new App();
}
});
}
}
Here are a few screenshots:
-
At start up

-
After horizontal resize

-
After typig a few charachers in the textfield

-
After moving the mouse over the button

I use Windows 7, Java 1.7.0 and Eclipse Indigo SR1.
I used JDK 1.7.0.0 and have now upgraded to JDK 1.7.0.10 but I still have the same problem.
When I print the system properties I get this result:
System.out.println(System.getProperty("java.version"));
System.out.println(System.getProperty("java.runtime.version"));
> 1.7.0_01
> 1.7.0_01-b08
In case the issue is caused by your graphics driver, setting one of the system properties below could help. Not quite sure if the props are still supported in Java 7.