I’m completely new to Linux and have been trying to get my (Windows built) Java Swing projects to work correctly on XUbuntu on a separate machine from executable jar files I built.
I’ve reduced the problem to a minimum amount of code
import java.awt.Dimension;
import javax.swing.*;
public class JFrameTest extends JFrame {
public JFrameTest(String title) {
super(title);
JLabel lab = new JLabel("Label");
this.getContentPane().add(lab);
this.setMinimumSize(new Dimension(200, 200));
this.pack();
this.setVisible(true);
}
public static void main(String args[]) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JFrameTest frame = new JFrameTest("Title");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
On Windows I see:

In Xubuntu I just see a grey box and the label, not the Title or close icons etc. I also have to kill (-9) the jvm after I’ve ctrl zedded from the command line. I launched it with java -jar filename.jar
My Linux machine is running Xubuntu 11. I’ve installed the sun Java 6_24 JRE. I Googled for this and found something similar relating to Compziz(?) but this was allegedly fixed a while back. I’m a bit stuck now. I have got one Swing app that works OK in that it responds to buttons OK but still doesn’t show the Title etc. Any help would be much appreciated.
I don’t use Xubuntu, but the general rule is that any code that updates a GUI should be executed on the Event Dispatch Thread. See the section from the Swing tutorial on Concurrency.
The examples from the Swing tutorial all use a format like this: