+ 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;
+ GridBagConstraints g = new GridBagConstraints();
+ this.setLayout(new GridBagLayout());
+ this.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) { dispose(); sb = null; }
+ });
+ g.gridx = g.gridy = GridBagConstraints.RELATIVE;
+ g.gridheight = 1;
+ g.weighty = 0;
+ g.fill = GridBagConstraints.NONE;
+ g.gridwidth = 1; g.weightx = 0;
+ g.insets = new Insets(8, 8, 8, 8);
+ this.add(new Label("Word list"), g);
+ g.fill = GridBagConstraints.HORIZONTAL;
+ g.gridwidth = GridBagConstraints.REMAINDER; g.weightx = 1;
+ g.insets.left = 0;
+ name = new TextField(20);
+ name.setText(file);
+ this.add(name, g);
+ g.insets.left = 8; g.insets.top = 0; g.gridwidth = 1;
+ g.weightx = 0; this.add(new Panel(), g);
+ g.weightx = 1; this.add(new Panel(), g);
+ g.weightx = 0;
+ g.insets.left = 0;
+ b = new Button("Cancel");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) { dispose(); sb = null; }
+ });
+ this.add(b, g);
+ b = new Button("OK");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ file = name.getText(); dispose(); sb = null;
+ }
+ });
+ this.add(b, g);
+ this.pack();
+ this.setVisible(true);
+ }
+ };
+
+ void splat(String gripe) { new Whinge(gripe); }
+ void settings() { if (sb != null) sb.toFront(); else sb = new Settings(); }