/* -*-java-*-
- *
- * $Id: AnagGUI.java,v 1.6 2003/11/29 23:38:37 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.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: AnagGUI.java,v $
- * Revision 1.6 2003/11/29 23:38:37 mdw
- * Debianization.
- *
- * Revision 1.5 2002/08/11 12:58:09 mdw
- * Added support for regular expression matching, if supported by the C
- * library.
- *
- * 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.
- *
- * 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.*;
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;
});
this.add(b, g);
this.pack();
- this.show();
+ this.setVisible(true);
}
};
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();
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) {
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());
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);
GridBagConstraints g = new GridBagConstraints();
Button b;
- file = System.getProperty("anag.dictionary", "/usr/dict/words");
sb = null;
g.gridx = g.gridy = GridBagConstraints.RELATIVE;
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); }