Java Swing: A Hello World GUI App (Video Tutorial Part 1)

Interested in GUI programming in Java? In this tutorial I show you how to build up a minimal "Hello World" user interface (Swing) app in Java.

After starting the video, click the maximise button to make it fullscreen so you can see the code!



Code For This Tutorial

 
import javax.swing.JFrame;
import javax.swing.SwingUtilities;


public class App {


    public static void main(String[] args) {
        
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JFrame frame = new JFrame("Hello World Swing!");
                frame.setSize(500, 400);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
            }
        });
    }

}