// This code example is created for educational purpose // by Thorsten Thormaehlen (contact: www.thormae.de). // It is distributed without any warranty. import javax.swing.*; class MyGui extends JFrame { public void createGUI() { setTitle("HelloGUI"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(320, 240); JLabel label = new JLabel("Hello World"); getContentPane().add(label); setVisible(true); } } public class HelloGUI { public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { MyGui myGUI = new MyGui(); myGUI.createGUI(); } }); } }