FileDocCategorySizeDatePackage
ToolbarFrame1.javaAPI DocExample1370Thu Oct 24 20:14:20 BST 2002None

ToolbarFrame1

public class ToolbarFrame1 extends Frame

Fields Summary
Button
cutButton
Button
copyButton
Button
pasteButton
Constructors Summary
public ToolbarFrame1()

    super("Toolbar Example (AWT)");
    setSize(450, 250);
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });

    ActionListener printListener = new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        System.out.println(ae.getActionCommand());
      }
    };

    Panel toolbar = new Panel();
    toolbar.setLayout(new FlowLayout(FlowLayout.LEFT));

    cutButton = new Button("Cut");
    cutButton.addActionListener(printListener);
    toolbar.add(cutButton);

    copyButton = new Button("Copy");
    copyButton.addActionListener(printListener);
    toolbar.add(copyButton);

    pasteButton = new Button("Paste");
    pasteButton.addActionListener(printListener);
    toolbar.add(pasteButton);

    // The "preferred" BorderLayout add call
    add(toolbar, BorderLayout.NORTH); 
  
Methods Summary
public static voidmain(java.lang.String[] args)

    ToolbarFrame1 tf1 = new ToolbarFrame1();
    tf1.setVisible(true);