Initial revision
[old-projects.git] / ekit / com / swabunga / spell / swing / JSpellDialog.java
1 package com.swabunga.spell.swing;
2
3 import com.swabunga.spell.event.*;
4 import javax.swing.*;
5 import javax.swing.text.*;
6 import java.io.File;
7 import java.awt.*;
8 import java.awt.event.*;
9
10 /** Implementation of a spell check dialog.
11 *
12 * @author Jason Height (jheight@chariot.net.au)
13 */
14 public class JSpellDialog extends JDialog implements ActionListener, WindowListener {
15 private JSpellForm form = new JSpellForm();
16 private SpellCheckEvent event = null;
17
18 public JSpellDialog(Frame owner, String title, boolean modal) {
19 super(owner, title, modal);
20 initialiseDialog();
21 }
22
23 public JSpellDialog(Dialog owner, String title, boolean modal) {
24 super(owner, title, modal);
25 initialiseDialog();
26 }
27
28 private void initialiseDialog() {
29 getContentPane().add(form);
30 form.addActionListener(this);
31 addWindowListener(this);
32 //setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
33 pack();
34 }
35
36
37 public void show(SpellCheckEvent e) {
38 // System.out.println("Show");
39 this.event = e;
40 form.setSpellEvent(e);
41 show();
42 }
43
44 public void actionPerformed(ActionEvent e) {
45 hide();
46 }
47
48 public void windowOpened(WindowEvent e) {
49 }
50 /** Cancel the event if the Dialog Close button is pressed*/
51 public void windowClosing(WindowEvent e) {
52 if (event != null)
53 event.cancel();
54 }
55 public void windowClosed(WindowEvent e) {
56 }
57 public void windowIconified(WindowEvent e) {
58 }
59 public void windowDeiconified(WindowEvent e) {
60 }
61 public void windowActivated(WindowEvent e) {
62 }
63 public void windowDeactivated(WindowEvent e) {
64 }
65 }