/** * Creates new form EnvironmentVarDialog. * * @param parent parent dialog * @param modal true: modal * @param categories array of categories */ public EnvironmentVarDialog(javax.swing.JDialog parent, boolean modal, Object[] categories) { super(parent, modal); initComponents(); typeComboBox.setModel(new DefaultComboBoxModel(PodVariant.Type.values())); categoryCombo.setModel(new DefaultComboBoxModel(categories)); setVisible(true); }
private void typeComboBoxActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_typeComboBoxActionPerformed { // GEN-HEADEREND:event_typeComboBoxActionPerformed PodVariant.Type type = (PodVariant.Type) typeComboBox.getSelectedItem(); CardLayout cardLayout = (CardLayout) (valueControlPanel.getLayout()); String cardName = type.equals(PodVariant.Type.BOOLEAN) ? "BOOLEAN" : type.equals(PodVariant.Type.DOUBLE) ? "NUMBER" : type.equals(PodVariant.Type.INTEGER) ? "NUMBER" : type.equals(PodVariant.Type.STRING) ? "TEXT" : type.equals(PodVariant.Type.PATH) ? "TEXT" : "BOOLEAN"; cardLayout.show(valueControlPanel, cardName); } // GEN-LAST:event_typeComboBoxActionPerformed
private void okButtonActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_okButtonActionPerformed { // GEN-HEADEREND:event_okButtonActionPerformed PodVariant.Type type = (PodVariant.Type) typeComboBox.getSelectedItem(); Object value = type.equals(PodVariant.Type.BOOLEAN) ? booleanCheck.isSelected() : type.equals(PodVariant.Type.DOUBLE) ? numberSpinner.getValue() : type.equals(PodVariant.Type.INTEGER) ? numberSpinner.getValue() : type.equals(PodVariant.Type.STRING) ? textPane.getText() : type.equals(PodVariant.Type.PATH) ? textPane.getText() : null; String category = categoryCombo.getSelectedItem().toString(); if (value != null) { theValue = new EnvironmentVar(type, category, varNameInput.getText(), true, new PodVariant(value)); } setVisible(false); } // GEN-LAST:event_okButtonActionPerformed