public void itemStateChanged(ItemEvent E) {
    // The 'log chat' checkbox
    if (E.getSource() == logChat) {
      server.logChats = logChat.getState();

      // Loop through all of the chat rooms, and set the logging
      // state to be the same as the value of the checkbox
      for (int count = 0; count < server.chatRooms.size(); count++) {
        babylonChatRoom tmp = (babylonChatRoom) server.chatRooms.elementAt(count);
        try {
          tmp.setLogging(server.logChats);
        } catch (IOException e) {
          server.serverOutput(
              server.strings.get(thisClass, "togglelogerror") + " " + tmp.name + "\n");
        }
      }
    }

    // The user list
    if (E.getSource() == userList) {
      // If anything is selected, enable the 'disconnect user'
      // button, otherwise disable it
      synchronized (userList) {
        disconnect.setEnabled(userList.getSelectedItem() != null);
      }
    }
  }
Exemple #2
0
 /** Handles CheckboxMenuItem state changes. */
 public void itemStateChanged(ItemEvent e) {
   MenuItem item = (MenuItem) e.getSource();
   MenuComponent parent = (MenuComponent) item.getParent();
   String cmd = e.getItem().toString();
   if ((Menu) parent == Menus.window) WindowManager.activateWindow(cmd, item);
   else doCommand(cmd);
 }
  public void itemStateChanged(ItemEvent e) {
    System.out.println("itemStateChanged");
    if (e.getSource() == ColChoice) // 预选颜色
    {
      String name = ColChoice.getSelectedItem();

      if (name == "black") {
        c = new Color(0, 0, 0);
      } else if (name == "red") {
        c = new Color(255, 0, 0);
      } else if (name == "green") {
        c = new Color(0, 255, 0);
      } else if (name == "blue") {
        c = new Color(0, 0, 255);
      }
    } else if (e.getSource() == SizeChoice) // 画笔大小
    {
      String selected = SizeChoice.getSelectedItem();

      if (selected == "1") {
        con = 1;
        size = new BasicStroke(con, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);

      } else if (selected == "3") {
        con = 3;
        size = new BasicStroke(con, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);

      } else if (selected == "5") {
        con = 5;
        size = new BasicStroke(con, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);

      } else if (selected == "7") {
        con = 7;
        size = new BasicStroke(con, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);

      } else if (selected == "9") {
        con = 9;
        size = new BasicStroke(con, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
      }
    } else if (e.getSource() == EraserChoice) // 橡皮大小
    {
      String Esize = EraserChoice.getSelectedItem();

      if (Esize == "5") {
        Econ = 5 * 2;
      } else if (Esize == "9") {
        Econ = 9 * 2;
      } else if (Esize == "13") {
        Econ = 13 * 2;
      } else if (Esize == "17") {
        Econ = 17 * 3;
      }
    }
  }
Exemple #4
0
  /** Handle ItemEvents. */
  public void itemStateChanged(ItemEvent e) {

    final String dialog_title = ResourceHandler.getMessage("template_dialog.title");

    Component target = (Component) e.getSource();

    if (target == recursiveCheckBox) {
      converter.setRecurse(recursiveCheckBox.isSelected());
    } else if (target == staticVersioningRadioButton || target == dynamicVersioningRadioButton) {
      converter.setStaticVersioning(staticVersioningRadioButton.isSelected());
    } else if (target == templateCh
        && (e.getStateChange() == e.SELECTED)) { // Process only when item is Selected

      // Get the current template selection
      String choiceStr = (String) templateCh.getSelectedItem();

      // If the user chooses 'other', display a file dialog to allow
      // them to select a template file.
      if (choiceStr.equals(TemplateFileChoice.OTHER_STR)) {
        String templatePath = null;
        FileDialog fd = new FileDialog(this, dialog_title, FileDialog.LOAD);
        fd.show();

        // Capture the path entered, if any.
        if (fd.getDirectory() != null && fd.getFile() != null) {
          templatePath = fd.getDirectory() + fd.getFile();
        }

        // If the template file is valid add it and select it.
        if (templatePath != null && setTemplateFile(templatePath)) {
          if (!templateCh.testIfInList(templatePath)) {
            templateCh.addItem(templatePath);
          }
          templateCh.select(templatePath);
        } else {
          templateCh.select(templateCh.getPreviousSelection());
        }
        fd.dispose();
      } else {
        templateCh.select(choiceStr);
      }
    }
  }
 public void itemStateChanged(ItemEvent e) {
   beta = Double.parseDouble(betaval.getText());
   updatebeta();
   boolean avgchanged = false;
   for (int i = 0; i < ncurves; i++) {
     if (checkarray[i].getState() != include[i]) {
       avgchanged = true;
       if (include[i]) {
         include[i] = false;
       } else {
         include[i] = true;
       }
     }
   }
   if (avgchanged) {
     updateavg();
     updatebeta();
     int1array[ncurves].setText("" + (float) intensity1[ncurves]);
     e1array[ncurves].setText("" + (float) bright1[ncurves]);
     n1array[ncurves].setText("" + (float) number1[ncurves]);
     int2array[ncurves].setText("" + (float) intensity2[ncurves]);
     e2array[ncurves].setText("" + (float) bright2[ncurves]);
     n2array[ncurves].setText("" + (float) number2[ncurves]);
     eccarray[ncurves].setText("" + (float) brightcc[ncurves]);
     pwavg.updateSeries(avg, 0, true);
     float[] temp = pwavg.getLimits();
     temp[4] = 1.0f;
     pwavg.setLimits(temp);
   }
   if (e.getSource() == dispcurvechoice) {
     dispcurve = dispcurvechoice.getSelectedIndex();
     pwfit.updateSeries(pch[dispcurve], 0, true);
     pwfit.updateSeries(fit[dispcurve], 1, true);
     float[] temp = pwfit.getLimits();
     temp[4] = 1.0f;
     pwfit.setLimits(temp);
   }
 }
Exemple #6
0
 public void itemRemoved(ItemEvent itemEvent) {
   println("Item removed = " + itemEvent.getItem());
 }
Exemple #7
0
 public void itemAdded(ItemEvent itemEvent) {
   println("Item added = " + itemEvent.getItem());
 }
Exemple #8
0
 @Override
 public void itemStateChanged(ItemEvent e) {
   if (e.getSource() instanceof JRadioButton) checkUeberSchreib();
 }
 public void itemStateChanged(ItemEvent evt) {
   // only on 'selection' event
   if (evt.getStateChange() == ItemEvent.SELECTED) {
     clOptions.show(pOptions, types[cbType.getSelectedIndex()]);
   }
 }
 public void itemStateChanged(ItemEvent i) {
   if (i.getStateChange() == ItemEvent.SELECTED) co = (String) i.getItem();
   z = 1;
 }