void addTextField(JPanel panel, String key, String label) { JLabel lab = new JLabel(label); lab.setAlignmentX(LEFT_ALIGNMENT); panel.add(lab); JTextField field = new JTextField(); field.setText(sketch.configFile.get(key)); field.setMaximumSize(new Dimension(Integer.MAX_VALUE, field.getPreferredSize().height)); fields.put(key, field); panel.add(field); }
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); }