1import javax.swing.*;
2class gui{
3 public static void main(String args[]){
4 JFrame frame = new JFrame("My First GUI");
5 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
6 frame.setSize(300,300);
7 JButton button = new JButton("Press");
8 frame.getContentPane().add(button); // Adds Button to content pane of frame
9 frame.setVisible(true);
10 }
11}
12