swing Getting started with swing "Hello World!" on window title with compatibility


Using java.lang.Runnable we make our "Hello World!" example available to Java users with versions dating all the way back to the 1.2 release:

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

public class Main {
    public static void main(String[] args){
        SwingUtilities.invokeLater(new Runnable(){

            public void run(){
                JFrame frame = new JFrame("Hello World!");
                frame.setSize(200, 100);