// Helene Martin, CSE 143 // A basic Swing graphical user interface. See chapter 14 of the book for more // on building complex user interfaces. import javax.swing.*; import java.awt.*; public class GUIDemo { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setLayout(new FlowLayout()); frame.setSize(300, 300); frame.setTitle("Yay!"); frame.setLocation(200, 400); JButton button = new JButton("Click me!!"); frame.add(button); JTextArea text = new JTextArea(5, 20); // without the scroll pane, the text area expands as more lines of text // are entered frame.add(new JScrollPane(text)); // closing the window stops the program frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }