import javax.swing.JButton; import javax.swing.JFrame; /** * Project #6.1 * CS 2334, Section 001 * October 3, 2003, 8:37 AM *

* This is an example class that shows how to create a simple GUI that consists * of a JButton. *

* @author Deborah Trytten * @version 1.0 */ public class Button { /** * This is the main method for this test program. Since this is a * simple test program, all of our code will be in the main method. * Typically this would be a bad design, but we are just testing out * some features of Java. *

* @param args Contains the command line arguments. */ public static void main(String[] args) { // Create the container. JFrame frame = new JFrame("A JButton"); // Create the button. JButton button = new JButton("Click Me!"); // Add the button to the container. frame.getContentPane().add(button); // Fit the frame to the container. frame.pack(); // Make the GUI visible on the screen. frame.setVisible(true); } }