Initial revision
[old-projects.git] / ekit / com / swabunga / spell / swing / JSpellDialog.java
diff --git a/ekit/com/swabunga/spell/swing/JSpellDialog.java b/ekit/com/swabunga/spell/swing/JSpellDialog.java
new file mode 100644 (file)
index 0000000..72df4e0
--- /dev/null
@@ -0,0 +1,65 @@
+package com.swabunga.spell.swing;\r\r
+\r\r
+import com.swabunga.spell.event.*;\r\r
+import javax.swing.*;\r\r
+import javax.swing.text.*;\r\r
+import java.io.File;\r\r
+import java.awt.*;\r\r
+import java.awt.event.*;\r\r
+\r\r
+/** Implementation of a spell check dialog.\r\r
+ *\r\r
+ * @author Jason Height (jheight@chariot.net.au)\r\r
+ */\r\r
+public class JSpellDialog extends JDialog implements ActionListener, WindowListener {\r\r
+  private JSpellForm form = new JSpellForm();\r\r
+  private SpellCheckEvent event = null;\r\r
+\r\r
+  public JSpellDialog(Frame owner, String title, boolean modal) {\r\r
+    super(owner, title, modal);\r\r
+    initialiseDialog();\r\r
+  }\r\r
+\r\r
+  public JSpellDialog(Dialog owner, String title, boolean modal) {\r\r
+    super(owner, title, modal);\r\r
+    initialiseDialog();\r\r
+  }\r\r
+\r\r
+  private void initialiseDialog() {\r\r
+    getContentPane().add(form);\r\r
+    form.addActionListener(this);\r\r
+    addWindowListener(this);\r\r
+    //setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);\r\r
+    pack();\r\r
+  }\r\r
+\r\r
+\r\r
+  public void show(SpellCheckEvent e) {\r\r
+   // System.out.println("Show");\r\r
+    this.event = e;\r\r
+    form.setSpellEvent(e);\r\r
+    show();\r\r
+  }\r\r
+\r\r
+  public void actionPerformed(ActionEvent e) {\r\r
+    hide();\r\r
+  }\r\r
+\r\r
+  public void windowOpened(WindowEvent e)  {\r\r
+  }\r\r
+  /** Cancel the event if the Dialog Close button is pressed*/\r\r
+  public void windowClosing(WindowEvent e) {\r\r
+    if (event != null)\r\r
+      event.cancel();\r\r
+  }\r\r
+  public void windowClosed(WindowEvent e) {\r\r
+  }\r\r
+  public void windowIconified(WindowEvent e) {\r\r
+  }\r\r
+  public void windowDeiconified(WindowEvent e) {\r\r
+  }\r\r
+  public void windowActivated(WindowEvent e) {\r\r
+  }\r\r
+  public void windowDeactivated(WindowEvent e) {\r\r
+  }\r\r
+}\r\r