From 435ab388589c4dc178c81e170c87b825a592f51a Mon Sep 17 00:00:00 2001 From: mdw Date: Mon, 19 Feb 2001 19:19:11 +0000 Subject: [PATCH] Add `help' button. Lowercase input to the command. --- AnagGUI.java | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/AnagGUI.java b/AnagGUI.java index de2a23f..1aee359 100644 --- a/AnagGUI.java +++ b/AnagGUI.java @@ -1,6 +1,6 @@ /* -*-java-*- * - * $Id: AnagGUI.java,v 1.3 2001/02/16 21:46:10 mdw Exp $ + * $Id: AnagGUI.java,v 1.4 2001/02/19 19:19:11 mdw Exp $ * * Front-end GUI * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: AnagGUI.java,v $ + * Revision 1.4 2001/02/19 19:19:11 mdw + * Add `help' button. Lowercase input to the command. + * * Revision 1.3 2001/02/16 21:46:10 mdw * Use a BufferedReader, not a LineNumberReader. * @@ -176,6 +179,15 @@ class AnagPanel extends Panel { } } + void help() { + try { + Process p = Runtime.getRuntime().exec("anag --help"); + listen(p); + } catch (IOException e) { + splat(e.toString()); + } + } + void getlist(String tag) { try { Vector v = new Vector(); @@ -184,7 +196,7 @@ class AnagPanel extends Panel { v.addElement("-file"); v.addElement(file); v.addElement(tag); - v.addElement(word.getText()); + v.addElement(word.getText().toLowerCase()); vv = new String[v.size()]; v.copyInto(vv); Process p = Runtime.getRuntime().exec(vv); @@ -200,7 +212,7 @@ class AnagPanel extends Panel { GridBagConstraints g = new GridBagConstraints(); Button b; - file = "/usr/dict/words"; + file = System.getProperty("anag.dictionary", "/usr/dict/words"); sb = null; g.gridx = g.gridy = GridBagConstraints.RELATIVE; @@ -258,6 +270,12 @@ class AnagPanel extends Panel { }); add(b, g); + b = new Button("Help!"); + b.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { help(); } + }); + add(b, g); + b = new Button("Settings..."); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { settings(); } @@ -280,8 +298,8 @@ public class AnagGUI extends Applet { f.show(); } public AnagGUI() { super(); setLayout(new BorderLayout()); } - public void init() { add(new AnagPanel()); } - public void destroy() { removeAll(); } + public void init() { /*add(new AnagPanel());*/ main(null); } + public void destroy() { /*removeAll();*/ } }; /*----- That's all, folks -------------------------------------------------*/ -- 2.11.0