FileDocCategorySizeDatePackage
BadIdea1.javaAPI DocExample3729Mon Apr 06 18:10:22 BST 1998None

BadIdea1

public class BadIdea1 extends Frame implements WindowListener, ActionListener

Fields Summary
Button
b1
Button
b2
Constructors Summary
public BadIdea1()

    
    setLayout(new FlowLayout());
    addWindowListener(this);
    b1.addActionListener(this);
    b2.addActionListener(this);
    add(b1);
    add(b2);
  
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

    Object source = e.getSource();
    if(source == b1)
      System.out.println("Button 1 pressed");
    else if(source == b2)
      System.out.println("Button 2 pressed");
    else
      System.out.println("Something else");
  
public static voidmain(java.lang.String[] args)

    Frame f = new BadIdea1();
    f.setSize(300,200);
    f.setVisible(true);
  
public voidwindowActivated(java.awt.event.WindowEvent e)

public voidwindowClosed(java.awt.event.WindowEvent e)

public voidwindowClosing(java.awt.event.WindowEvent e)

    System.out.println("Window Closing");
    System.exit(0);
  
public voidwindowDeactivated(java.awt.event.WindowEvent e)

public voidwindowDeiconified(java.awt.event.WindowEvent e)

public voidwindowIconified(java.awt.event.WindowEvent e)

public voidwindowOpened(java.awt.event.WindowEvent e)