import javax.swing.*; public class ButtonExample { public static void main(String[] args) { // create and set up the window. JFrame frame = new JFrame("Button Example!"); // make the program close when the window closes frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // add a button object JButton button = new JButton("Push Me!"); frame.getContentPane().add(button); // display the window. frame.pack(); frame.setVisible(true); } }