Methods Summary |
---|
public void | actionPerformed(java.awt.event.ActionEvent e)
if (e.getActionCommand() == SHOW) {
window.pack();
window.setVisible(true);
} else {
display.setText("");
}
|
void | displayMessage(java.lang.String prefix, java.awt.event.WindowEvent e)
display.append(prefix
+ ": "
+ e.getWindow()
+ newline);
|
public void | init()
b1 = new JButton("Click to bring up a window.");
b1.setActionCommand(SHOW);
b1.addActionListener(this);
b2 = new JButton("Click to clear the display.");
b2.setActionCommand(CLEAR);
b2.addActionListener(this);
display = new JTextArea();
display.setEditable(false);
JScrollPane scrollPane = new JScrollPane(display);
scrollPane.setPreferredSize(new Dimension(200, 75));
JPanel contentPane = new JPanel();
contentPane.setLayout(new BorderLayout());
contentPane.add(b1, BorderLayout.NORTH);
contentPane.add(scrollPane, BorderLayout.CENTER);
contentPane.add(b2, BorderLayout.SOUTH);
setContentPane(contentPane);
//Create but don't show window.
window = new JFrame("Window Event Window");
window.addWindowListener(this);
JLabel l = new JLabel("The applet listens to this window"
+ " for window events.");
window.getContentPane().add(l, BorderLayout.CENTER);
window.pack();
|
public void | stop()
window.setVisible(false);
|
public void | windowActivated(java.awt.event.WindowEvent e)
displayMessage("Window activated", e);
|
public void | windowClosed(java.awt.event.WindowEvent e)
displayMessage("Window closed", e);
|
public void | windowClosing(java.awt.event.WindowEvent e)
window.setVisible(false);
displayMessage("Window closing", e);
|
public void | windowDeactivated(java.awt.event.WindowEvent e)
displayMessage("Window deactivated", e);
|
public void | windowDeiconified(java.awt.event.WindowEvent e)
displayMessage("Window deiconified", e);
|
public void | windowIconified(java.awt.event.WindowEvent e)
displayMessage("Window iconified", e);
|
public void | windowOpened(java.awt.event.WindowEvent e)
displayMessage("Window opened", e);
|