The Quintessential Swing User Interface This example creates and shows a frame with a button. import java.awt.*; import javax.swing.*; public class BasicUI { public static void main(String[] args) { JButton button = new JButton("Label"); JFrame frame = new JFrame(); // Add button to the frame. frame.getContentPane().add( button, BorderLayout.CENTER); // Set initial size. frame.setSize(300, 300); // Show the frame. frame.setVisible(true); } }