예제 #1
0
 /**
  * Reacts to property changes fired by the{@link ServerEditor}.
  *
  * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
  */
 public void propertyChange(PropertyChangeEvent evt) {
   String name = evt.getPropertyName();
   if (ServerEditor.EDIT_PROPERTY.equals(name)) {
     Boolean value = (Boolean) evt.getNewValue();
     if (editor.isEditing()) finishButton.setEnabled(value);
     else {
       if (originalIndexSpeed == -1) {
         setControlEnabled(originalIndexSpeed);
       }
       if (buttonsGroup != null) {
         Enumeration en = buttonsGroup.getElements();
         JRadioButton button;
         int index;
         while (en.hasMoreElements()) {
           button = (JRadioButton) en.nextElement();
           if (button.isSelected()) {
             index = Integer.parseInt(button.getActionCommand());
             setControlEnabled(index);
           }
         }
       }
     }
   } else if (ServerEditor.ADD_MESSAGE_PROPERTY.equals(name)) {
     showMessagePanel(true, (JComponent) evt.getNewValue());
   } else if (ServerEditor.REMOVE_MESSAGE_PROPERTY.equals(name)) {
     showMessagePanel(false, (JComponent) evt.getNewValue());
   } else if (ServerEditor.APPLY_SERVER_PROPERTY.equals(name)) {
     apply();
   }
 }
예제 #2
0
        public void actionPerformed(ActionEvent evt) {
          JRadioButton source = (JRadioButton) evt.getSource();

          if (source.getActionCommand().equals("none")) {
            capture = CAPTURE_NONE;
            fldInterval.setEnabled(false);
            buttonLabel.setText(NONE_HELP);
          } else if (source.getActionCommand().equals("interval")) {
            capture = CAPTURE_INTERVAL;
            fldInterval.setEnabled(true);
            buttonLabel.setText(INTERVAL_HELP);
          } else {
            capture = CAPTURE_PAUSE;
            buttonLabel.setText(PAUSE_HELP);
            fldInterval.setEnabled(false);
          }
        }
예제 #3
0
 public void itemStateChanged(ItemEvent e) {
   if (e.getStateChange() == ItemEvent.SELECTED) {
     JRadioButton jrb = (JRadioButton) e.getSource();
     choice = jrb.getActionCommand();
     answer[i - 1] = choice;
     System.out.println(answer[i - 1]);
   }
 }
예제 #4
0
 /** Fires a property indicating that a new server is selected. */
 private void apply() {
   // Check list of servers and remove empty from list
   String server = null;
   if (editor != null) {
     editor.stopEdition();
     server = editor.getSelectedServer();
     editor.onApply();
   }
   if (server != null && server.length() > 0) {
     String port = editor.getSelectedPort();
     editor.handleServers(server, editor.getSelectedPort());
     String value = server + ServerEditor.SERVER_PORT_SEPARATOR + port;
     firePropertyChange(SERVER_PROPERTY, null, value);
   }
   if (buttonsGroup != null) {
     Enumeration en = buttonsGroup.getElements();
     JRadioButton button;
     int index;
     while (en.hasMoreElements()) {
       button = (JRadioButton) en.nextElement();
       if (button.isSelected()) {
         index = Integer.parseInt(button.getActionCommand());
         switch (index) {
           case HIGH_SPEED:
             firePropertyChange(
                 CONNECTION_SPEED_PROPERTY, null, Integer.valueOf(LoginCredentials.HIGH));
             break;
           case MEDIUM_SPEED:
             firePropertyChange(
                 CONNECTION_SPEED_PROPERTY, null, Integer.valueOf(LoginCredentials.MEDIUM));
             break;
           case LOW_SPEED:
             firePropertyChange(
                 CONNECTION_SPEED_PROPERTY, null, Integer.valueOf(LoginCredentials.LOW));
         }
       }
     }
   }
   close();
 }