chiark
/
gitweb
/
~mdw
/
anag
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add `help' button. Lowercase input to the command.
[anag]
/
AnagGUI.java
diff --git
a/AnagGUI.java
b/AnagGUI.java
index ccae5914554e144062e32699459bd3ddcfb1eab0..1aee3590f14a3bb85e81119ca770f3246dca72f1 100644
(file)
--- a/
AnagGUI.java
+++ b/
AnagGUI.java
@@
-1,6
+1,6
@@
/* -*-java-*-
*
/* -*-java-*-
*
- * $Id: AnagGUI.java,v 1.
2 2001/02/07 09:10:04
mdw Exp $
+ * $Id: AnagGUI.java,v 1.
4 2001/02/19 19:19:11
mdw Exp $
*
* Front-end GUI
*
*
* Front-end GUI
*
@@
-29,6
+29,12
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: AnagGUI.java,v $
/*----- 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.
+ *
* 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
* 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
@@
-134,10
+140,10
@@
class AnagPanel extends Panel {
void settings() { if (sb != null) sb.toFront(); else sb = new Settings(); }
void listen(Process p) throws IOException {
void settings() { if (sb != null) sb.toFront(); else sb = new Settings(); }
void listen(Process p) throws IOException {
-
LineNumber
Reader fout =
- new
LineNumber
Reader(new InputStreamReader(p.getInputStream()));
-
LineNumber
Reader ferr =
- new
LineNumber
Reader(new InputStreamReader(p.getErrorStream()));
+
Buffered
Reader fout =
+ new
Buffered
Reader(new InputStreamReader(p.getInputStream()));
+
Buffered
Reader ferr =
+ new
Buffered
Reader(new InputStreamReader(p.getErrorStream()));
String l;
Vector v = new Vector();
String l;
Vector v = new Vector();
@@
-173,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();
void getlist(String tag) {
try {
Vector v = new Vector();
@@
-181,7
+196,7
@@
class AnagPanel extends Panel {
v.addElement("-file");
v.addElement(file);
v.addElement(tag);
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);
vv = new String[v.size()];
v.copyInto(vv);
Process p = Runtime.getRuntime().exec(vv);
@@
-197,7
+212,7
@@
class AnagPanel extends Panel {
GridBagConstraints g = new GridBagConstraints();
Button b;
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;
sb = null;
g.gridx = g.gridy = GridBagConstraints.RELATIVE;
@@
-255,6
+270,12
@@
class AnagPanel extends Panel {
});
add(b, g);
});
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(); }
b = new Button("Settings...");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { settings(); }
@@
-277,8
+298,8
@@
public class AnagGUI extends Applet {
f.show();
}
public AnagGUI() { super(); setLayout(new BorderLayout()); }
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 -------------------------------------------------*/
};
/*----- That's all, folks -------------------------------------------------*/