示例#1
0
  public void save() {
    for (String key : fields.keySet()) {
      JComponent comp = fields.get(key);

      if (comp instanceof JTextField) {
        JTextField c = (JTextField) comp;

        if (c.getText().trim().equals("")) {
          sketch.configFile.unset(key);
        } else {
          sketch.configFile.set(key, c.getText());
        }
      } else if (comp instanceof JTextArea) {
        JTextArea c = (JTextArea) comp;

        if (c.getText().trim().equals("")) {
          sketch.configFile.unset(key);
        } else {
          sketch.configFile.set(key, c.getText());
        }
      }
    }

    sketch.saveConfig();
  }
示例#2
0
 void addTextArea(JPanel panel, String key, String label) {
   JLabel lab = new JLabel(label);
   lab.setAlignmentX(LEFT_ALIGNMENT);
   panel.add(lab);
   JTextArea field = new JTextArea();
   field.setText(sketch.configFile.get(key));
   field.setLineWrap(true);
   field.setWrapStyleWord(true);
   fields.put(key, field);
   JScrollPane scroll = new JScrollPane(field);
   scroll.setAlignmentX(0.0f);
   panel.add(scroll);
 }