01: package com.xoetrope.carousel.langed;
02:
03: import java.awt.Dialog;
04: import java.awt.Frame;
05: import java.awt.event.ActionEvent;
06: import java.awt.event.ActionListener;
07: import java.awt.event.WindowEvent;
08: import java.awt.event.WindowListener;
09: import javax.swing.JDialog;
10:
11: import com.swabunga.spell.event.SpellCheckEvent;
12:
13: /** Implementation of a spell check dialog.
14: *
15: * @author Jason Height (jheight@chariot.net.au)
16: */
17: public class JSpellDialog extends JDialog implements ActionListener,
18: WindowListener {
19: private JSpellForm form = new JSpellForm();
20: private SpellCheckEvent event = null;
21:
22: public JSpellDialog(Frame owner, String title, boolean modal) {
23: super (owner, title, modal);
24: initialiseDialog();
25: }
26:
27: public JSpellDialog(Dialog owner, String title, boolean modal) {
28: super (owner, title, modal);
29: initialiseDialog();
30: }
31:
32: private void initialiseDialog() {
33: getContentPane().add(form);
34: form.addActionListener(this );
35: addWindowListener(this );
36: //setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
37: pack();
38: }
39:
40: public void show(SpellCheckEvent e) {
41: // System.out.println("Show");
42: this .event = e;
43: form.setSpellEvent(e);
44: setVisible(true);
45: }
46:
47: public void actionPerformed(ActionEvent e) {
48: setVisible(false);
49: }
50:
51: /** Cancel the event if the Dialog Close button is pressed*/
52: public void windowClosing(WindowEvent e) {
53: if (event != null)
54: event.cancel();
55: }
56:
57: public void windowOpened(WindowEvent e) {
58: }
59:
60: public void windowClosed(WindowEvent e) {
61: }
62:
63: public void windowIconified(WindowEvent e) {
64: }
65:
66: public void windowDeiconified(WindowEvent e) {
67: }
68:
69: public void windowActivated(WindowEvent e) {
70: }
71:
72: public void windowDeactivated(WindowEvent e) {
73: }
74: }
|