Following is a sample Hello World JFrame code. Good for beginners.
Java Code:
import javax.swing.JFrame;
import javax.swing.JLabel;

public final class HelloWorld extends JFrame {
private HelloWorld() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().add(new JLabel("Hello, World!"));
pack();
setLocationRelativeTo(null);
}

public static void main(String[] args) {
new HelloWorld().setVisible(true);
}
}