X-Git-Url: https://git.distorted.org.uk/~mdw/anag/blobdiff_plain/162ffb5e5a4522b64f7fe891608b197d63f21535..cdb480951031f64f4785da1787b16fe235b76f13:/AnagGUI.java diff --git a/AnagGUI.java b/AnagGUI.java index de2a23f..7211c79 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.7 2004/04/08 01:36:18 mdw Exp $ * * Front-end GUI * @@ -26,22 +26,6 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: AnagGUI.java,v $ - * Revision 1.3 2001/02/16 21:46:10 mdw - * Use a BufferedReader, not a LineNumberReader. - * - * Revision 1.2 2001/02/07 09:10:04 mdw - * Add a settings panel (currently only allows the wordlist to be - * changed). Move the buttons down the right-hand side of the list. Add a - * `Run' button which passes arguments through directly. - * - * Revision 1.1 2001/02/04 19:53:07 mdw - * Simple GUI front-end in Java. - * - */ - /*----- Imports -----------------------------------------------------------*/ import java.lang.*; @@ -176,6 +160,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 +177,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 +193,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; @@ -246,6 +239,24 @@ class AnagPanel extends Panel { }); add(b, g); + b = new Button("Regular expression"); + b.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { getlist("-regexp"); } + }); + add(b, g); + + b = new Button("Perl regexp"); + b.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { getlist("-pcre"); } + }); + add(b, g); + + b = new Button("Monoalphabetic"); + b.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { getlist("-mono"); } + }); + add(b, g); + b = new Button("Trackword"); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getlist("-trackword"); } @@ -258,6 +269,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 +297,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 -------------------------------------------------*/