Creates a new MethodInnerClassDemo object.
super();
setTitle("Inner Class Demo");
setModal(true);
contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
JLabel logoLabel = new JLabel(LOGO);
contentPane.add(BorderLayout.NORTH, logoLabel);
JButton btn1 = new JButton("Beep");
JButton btn2 = new JButton("Bell");
/**
* An action listener class.
*
* @author <a href=mailto:kraythe@arcor.de>Robert Simmons jr. (kraythe)</a>
* @version $Revision: 1.6 $
*/
class MyActionListener implements ActionListener {
/**
* {@inheritDoc}
*/
public void actionPerformed(final ActionEvent event) {
Toolkit.getDefaultToolkit()
.beep();
}
}
btn1.addActionListener(new MyActionListener());
btn2.addActionListener(new MyActionListener());
JPanel pnl = new JPanel(new GridLayout(1, 2));
pnl.add(btn1);
pnl.add(btn2);
contentPane.add(BorderLayout.SOUTH, pnl);
pack();