// A first application that makes use of GApp import java.awt.*; import java.awt.event.*; import javax.swing.*; public class FirstApp extends JPanel { private JLabel lbl = new JLabel("Hi there"); private JButton btn = new JButton("Hide it"); public FirstApp() { btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (lbl.isVisible()) { lbl.setVisible(false); btn.setLabel("Show it"); } else { lbl.setVisible(true); btn.setLabel("Hide it"); } } }); add(lbl); add(btn); } public static void main(String[] args) { FirstApp fa = new FirstApp(); GApp app = new GApp("The First App", fa); app.setSize(250, 100); app.show(); } }