Пример #1
0
 private void addListener(ID id, JTextField textField, Entry<ID, List<ID>> entry) {
   if (id.equals(entry.getKey())) {
     textField
         .getDocument()
         .addDocumentListener(
             (new CalculatorListener(
                 patronElements, questionProperties, componentList, textField, id)));
   }
 }
Пример #2
0
 private JTextField createTextField(ID id, boolean editable, QuestionData data) {
   JTextField textField = new JTextField();
   String value = calculateText(data);
   textField.setText(value);
   textField.setEditable(editable);
   textField.setName(id.getValue());
   addListeners(id, textField);
   return textField;
 }
Пример #3
0
  private JPanel generatePanel(ID id, String label, boolean visibility, JTextField textField) {
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(2, 0));
    panel.add(new JLabel(label));
    panel.add(Box.createRigidArea(new Dimension(0, 5)));

    panel.add(textField);
    panel.setName(id.getValue());
    panel.setVisible(visibility);
    return panel;
  }