// // Simple creation of two buttons which each send their // Action to different Listeners // import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class StubApp { private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("Button Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // set up content pane StubPanel newContentPane = new StubPanel(); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }