Quick lick of paint before we really get started.
[anag] / AnagGUI.java
index 7211c79..dde7b2f 100644 (file)
@@ -1,13 +1,11 @@
 /* -*-java-*-
  *
- * $Id: AnagGUI.java,v 1.7 2004/04/08 01:36:18 mdw Exp $
- *
  * Front-end GUI
  *
  * (c) 2001 Mark Wooding
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of Anag: a simple wordgame helper.
  *
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * Anag is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with Anag; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -61,19 +59,21 @@ class Whinge extends Frame {
     g.insets.top = 0; g.insets.bottom = 24;
     add(b, g);
     pack();
-    show();    
+    setVisible(true);
   }
 };
 
 class AnagPanel extends Panel {
   TextField word;
   java.awt.List list;
-  String file;
   Settings sb;
+  String anag = System.getProperty("anag.program", "anag");
+  String file = System.getProperty("anag.dictionary",
+                                  "/usr/share/dict/words");
 
   class Settings extends Frame {
     TextField name;
-  
+
     public Settings() {
       super("AnagGUI settings");
       Button b;
@@ -113,7 +113,7 @@ class AnagPanel extends Panel {
       });
       this.add(b, g);
       this.pack();
-      this.show();
+      this.setVisible(true);
     }
   };
 
@@ -127,7 +127,7 @@ class AnagPanel extends Panel {
       new BufferedReader(new InputStreamReader(p.getErrorStream()));
 
     String l;
-    Vector v = new Vector();
+    Vector<String> v = new Vector<String>();
     while ((l = fout.readLine()) != null)
       v.addElement(l);
     StringBuffer d = new StringBuffer();
@@ -149,10 +149,9 @@ class AnagPanel extends Panel {
   void run() {
     try {
       StringBuffer b = new StringBuffer();
-      b.append("anag -file ")
-       .append(file)
-       .append(" ")
-       .append(word.getText());
+      b.append(anag)
+       .append(" -file ").append(file)
+       .append(" ").append(word.getText());
       Process p = Runtime.getRuntime().exec(b.toString());
       listen(p);
     } catch (IOException e) {
@@ -162,7 +161,7 @@ class AnagPanel extends Panel {
 
   void help() {
     try {
-      Process p = Runtime.getRuntime().exec("anag --help");
+      Process p = Runtime.getRuntime().exec(anag + " --help");
       listen(p);
     } catch (IOException e) {
       splat(e.toString());
@@ -171,9 +170,9 @@ class AnagPanel extends Panel {
 
   void getlist(String tag) {
     try {
-      Vector v = new Vector();
+      Vector<String> v = new Vector<String>();
       String[] vv;
-      v.addElement("anag");
+      v.addElement(anag);
       v.addElement("-file");
       v.addElement(file);
       v.addElement(tag);
@@ -193,7 +192,6 @@ class AnagPanel extends Panel {
     GridBagConstraints g = new GridBagConstraints();
     Button b;
 
-    file = System.getProperty("anag.dictionary", "/usr/dict/words");
     sb = null;
 
     g.gridx = g.gridy = GridBagConstraints.RELATIVE;
@@ -289,12 +287,12 @@ public class AnagGUI extends Applet {
   public static void main(String[] argv) {
     Frame f = new Frame("Anagram solver");
     f.addWindowListener(new WindowAdapter() {
-       public void windowClosing(WindowEvent e) { System.exit(0); }
+      public void windowClosing(WindowEvent e) { System.exit(0); }
     });
     AnagPanel p = new AnagPanel();
     f.add(p);
     f.pack();
-    f.show();
+    f.setVisible(true);
   }
   public AnagGUI() { super(); setLayout(new BorderLayout()); }
   public void init() { /*add(new AnagPanel());*/ main(null); }