package tmp; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; public class Keyboard extends JDialog implements ActionListener { JPanel theBoard = new JPanel(); BorderLayout border = new BorderLayout(); public Keyboard(Frame parent) { super(parent); enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { init(); } catch(Exception e) { e.printStackTrace(); } //imageControl1.setIcon(imageIcon); pack(); } private void init() throws Exception { this.setTitle("KeyBoard Tutor"); setResizable(false); theBoard.setLayout(border); } protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { cancel(); } super.processWindowEvent(e); } void cancel() { dispose(); } /*public void actionPerformed(ActionEvent e) { if (e.getSource() == button1) { cancel(); } }*/ }