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);
      }
    }
  }
Beispiel #2
0
  public void itemStateChanged(ItemEvent evt) {
    if (evt.getSource() == farbe) {
      status.setText("Farbe " + farben[farbe.getSelectedIndex()] + " ausgewaehlt");

      switch (farbe.getSelectedIndex()) {
        case 0:
          color = Color.blue;
          break;
        case 1:
          color = Color.yellow;
          break;
        case 2:
          color = Color.green;
          break;
        case 3:
          color = Color.red;
          break;
        case 4:
          color = Color.black;
          break;
        case 5:
          color = Color.white;
      }
    } else if (evt.getSource() == filled) {
      if (filled.getState() == true) status.setText("Ausgefuellt zeichnen");
      else status.setText("Rahmen zeichnen");
    }
  }
    public void itemStateChanged(ItemEvent e) {
      if (e.getStateChange() == ItemEvent.SELECTED) {
        int oldDay = selectedDay;
        int oldMonth = selectedMonth;
        int oldYear = selectedYear;

        String dayString = ((JToggleButton) e.getItem()).getText();
        try {
          selectedDay = Integer.parseInt(dayString);
        } catch (Exception ex) {
          selectedDay = 1;
        }
        selectedMonth = displayMonth;
        selectedYear = displayYear;

        if (oldDay != selectedDay || oldMonth != selectedMonth || oldYear != selectedYear) {

          isNullDate = false;
          selectedCalendar.set(Calendar.YEAR, selectedYear);
          selectedCalendar.set(Calendar.MONTH, selectedMonth);
          selectedCalendar.set(Calendar.DATE, selectedDay);

          updateCalendarComponents();
          fireDateChange();
        }
      }
    }
Beispiel #4
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 static void openProducedItemDescription(final ItemEvent itemEvent, final Window window) {
   if (itemEvent.getItemValue() instanceof RecipeView) {
     openProducedItemDescription(itemEvent, (RecipeView) itemEvent.getItemValue(), window);
   } else if (itemEvent.getItemValue() instanceof AbstractCraftHarvestElement) {
     openProducedItemDescription(
         itemEvent, (AbstractCraftHarvestElement) itemEvent.getItemValue(), window);
   }
 }
Beispiel #6
0
 /** For the user selected answer event. */
 public void itemStateChanged(ItemEvent evt) { // ***Event
   if (evt.getStateChange() == ItemEvent.SELECTED) {
     if (evt.getSource() == cBox_Price) {
       que.setUserChoice(Q4_PriceDistance.PRICE);
     } else if (evt.getSource() == cBox_Distance) {
       que.setUserChoice(Q4_PriceDistance.DISTANCE);
     }
   }
 }
 @Override
 public void itemStateChanged(ItemEvent e) {
   Object source = e.getItemSelectable();
   CPArtwork artwork = controller.getArtwork();
   if (source == cbSampleAllLayers) {
     artwork.setSampleAllLayers(e.getStateChange() == ItemEvent.SELECTED);
   } else if (source == cbLockAlpha) {
     artwork.setLockAlpha(e.getStateChange() == ItemEvent.SELECTED);
   }
 }
    /**
     * Invoked when an item has been selected or deselected by the user. The code written for this
     * method performs the operations that need to occur when an item is selected (or deselected).
     */
    @Override
    public void itemStateChanged(ItemEvent e) {
      String result = null;
      if (e.getSource().equals(cm_debug)) {
        result = (String) e.getItem();
      } else if (e.getSource().equals(cm_test)) {
        result = (String) e.getItem();
      }

      updateDebugPanelState(result, cm_debug.getState(), cm_test.getState());
    }
Beispiel #9
0
 public void itemStateChanged(ItemEvent evt) {
   if (evt.getSource().equals(box_black)) {
     box_color = Color.black;
   } else if (evt.getSource().equals(box_red)) {
     box_color = Color.red;
   } else if (evt.getSource().equals(box_gray)) {
     box_color = Color.gray;
   } else if (evt.getSource().equals(box_blue)) {
     box_color = Color.blue;
   }
 }
Beispiel #10
0
  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;
      }
    }
  }
 @Override
 public void itemStateChanged(ItemEvent e) {
   if (e.getItem() == "Free") {
     model.setChoiceFree();
   }
   if (e.getItem() == "Together") {
     model.setChoiceTogether();
   }
   if (e.getItem() == "Against") {
     model.setChoiceAganist();
   }
 }
Beispiel #12
0
 @Override
 public void itemStateChanged(ItemEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == box) {
     getFindData();
   }
 }
  public void itemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {
      p5.add(mortgage);
      Slot pobject;
      pobject = Game.SlotsList[x.getProperties().get(propertydisplay.getSelectedIndex())];
      if (pobject instanceof Property) {
        ((Property) (pobject)).monopolizeProperty();
        pr1.setText("Buy Price:" + pobject.getBuyPrice());
        pr2.setText("Rent Price:" + pobject.getRentPrice());
        pr3.setText("House Price:" + pobject.getHousePrice());
        pr4.setText("Hotel Price:" + pobject.getHotelPrice());
        pr5.setText("Mortgaged:" + pobject.getMortgage());
      } else if (pobject instanceof Railroad) {
        pobject.adjustRentPrice();
        pr1.setText("Buy Price:" + pobject.getBuyPrice());
        pr2.setText("Rent Price:" + pobject.getRentPrice());
        pr3.setText("");
        pr4.setText("");
        pr5.setText("");

      } else {
        pobject.adjustDiceFactor();
        pr1.setText("Buy Price:" + pobject.getBuyPrice());
        pr2.setText("Dice Factor:" + pobject.getDiceFactor());
        pr3.setText("");
        pr4.setText("");
        pr5.setText("");
      }
    }
  }
 public void itemStateChanged(ItemEvent e) {
   JMenuItem source = (JMenuItem) (e.getSource());
   String s =
       "Item event detected."
           + newline
           + "    Event source: "
           + source.getText()
           + " (an instance of "
           + getClassName(source)
           + ")"
           + newline
           + "    New state: "
           + ((e.getStateChange() == ItemEvent.SELECTED) ? "selected" : "unselected");
   output.append(s + newline);
   output.setCaretPosition(output.getDocument().getLength());
 }
Beispiel #15
0
 @Override
 public void itemStateChanged(ItemEvent e) {
   if (e.getItem() == PerfMeasureType.CUSTOM) mAddPerfMeasures.setVisible(true);
   else {
     mAddPerfMeasures.setVisible(false);
     mTypeToWeight.clear();
   }
 }
Beispiel #16
0
  @Override
  public void itemStateChanged(ItemEvent e) {
    p.setFocus();

    if (e.getStateChange() == ItemEvent.SELECTED) {
      p.getR().hardMode(true);
    } else {
      p.getR().hardMode(false);
    }
  }
Beispiel #17
0
  public void itemStateChanged(ItemEvent ie) {

    if (ie.getSource() == c1) {
      String s = c1.getLabel();
      g = s;
    } else {
      String s = c2.getLabel();
      g = s;
    }
  }
Beispiel #18
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);
      }
    }
  }
Beispiel #19
0
 public void itemStateChanged(ItemEvent e) {
   if (e.getStateChange() == ItemEvent.SELECTED) {
     scale = parseScale(cmbScale.getSelectedItem().toString());
     if (scale < 100) {
       scale = 100;
     } else if (scale > 100000) {
       scale = 100000;
     }
     cmbScale.setSelectedItem("1:" + scale);
     guiChanged();
   }
 }
Beispiel #20
0
 /** Fire accessible property change events when the state of the toggle button changes. */
 public void itemStateChanged(ItemEvent e) {
   Checkbox cb = (Checkbox) e.getSource();
   if (Checkbox.this.accessibleContext != null) {
     if (cb.getState()) {
       Checkbox.this.accessibleContext.firePropertyChange(
           AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null, AccessibleState.CHECKED);
     } else {
       Checkbox.this.accessibleContext.firePropertyChange(
           AccessibleContext.ACCESSIBLE_STATE_PROPERTY, AccessibleState.CHECKED, null);
     }
   }
 }
 /** Capture des évènements des menus choix */
 public void itemStateChanged(ItemEvent e) {
   if (e.getSource().equals(choix_couleur0)) {
     if (e.getItem() == "rouge") {
       choix_couleur0.setBackground(Color.red);
       choix_couleur1.setBackground(Color.blue);
       choix_couleur1.select("bleu");
       couleurs[0] = ROUGE;
       couleurs[1] = BLEU;
     }
     if (e.getItem() == "bleu") {
       choix_couleur0.setBackground(Color.blue);
       choix_couleur1.setBackground(Color.red);
       choix_couleur1.select("rouge");
       couleurs[0] = BLEU;
       couleurs[1] = ROUGE;
     }
   }
   if (e.getSource().equals(choix_couleur1)) {
     if (e.getItem() == "rouge") {
       choix_couleur1.setBackground(Color.red);
       choix_couleur0.setBackground(Color.blue);
       choix_couleur0.select("bleu");
       couleurs[1] = ROUGE;
       couleurs[0] = BLEU;
     }
     if (e.getItem() == "bleu") {
       choix_couleur1.setBackground(Color.blue);
       choix_couleur0.setBackground(Color.red);
       choix_couleur0.select("rouge");
       couleurs[1] = BLEU;
       couleurs[0] = ROUGE;
     }
   }
 } // itemStateChanged()
  private void cmbLieferantItemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED && cmbLieferant.getSelectedIndex() > 0) {

      lieferant = (Lieferanten) cmbLieferant.getSelectedItem();
      Tools.log(txtLog, "=================================================================");
      Tools.log(txtLog, "Ab jetzt wird auf Lieferant: \"" + lieferant.getFirma() + "\" umgebucht.");
      Tools.log(txtLog, "=================================================================");
      loadVorratTable();
      txtSearch.requestFocus();
    } else {
      lieferant = null;
    }
  }
    // GL
    public synchronized void itemStateChanged(ItemEvent e) {
      if (e.getSource() == hsb) isRGB = false;
      if (e.getSource() == rgb) isRGB = true;

      if (e.getSource() == hsb || e.getSource() == rgb) {
        flag = true;
        originalB.setEnabled(false);
        filteredB.setEnabled(false);

        minHue = minSat = minBri = 0;
        maxHue = maxSat = maxBri = 255;

        bandPassH.setState(true);
        bandPassS.setState(true);
        bandPassB.setState(true);
      }
      reset(imp, ip);
      ip = setup(imp);
      apply(imp, ip);
      updateNames();
      notify();
    }
Beispiel #24
0
    public void itemStateChanged(ItemEvent e) {
      Checkbox ch = (Checkbox) e.getSource();
      String label = ch.getLabel();

      if (checkbox.getState() == true) {
        for (int i = 0; i < 3; i++) {
          cb[i].setEnabled(true);
        }
      } else if (checkbox.getState() == false) {
        for (int i = 0; i < 3; i++) {
          cb[i].setEnabled(false);
        }
      }

      if (e.getStateChange() == ItemEvent.SELECTED) {
        System.out.println(label + " selected.");
        lb.setText(label + " selected.");
      } else {
        System.out.println(label + " deselected.");
        lb.setText(label + " deselected.");
      }
    }
  //  Handle checkbox changed events
  public void itemStateChanged(ItemEvent event) {
    Object src = event.getSource();

    for (int i = 0; i < checks.length; i++) {
      if (src == checks[i]) {
        // Update the checkboxes
        checks[current].setState(false);
        current = i;
        checks[current].setState(true);

        if (listener != null) listener.checkboxChanged(this, i);
        return;
      }
    }
  }
 public void itemStateChanged(ItemEvent event) {
   Object item = event.getItem();
   if (item == gui.quickpick) {
     for (int i = 0; i < 6; i++) {
       int pick;
       do {
         pick = (int) Math.floor(Math.random() * 50 + 1);
       } while (numberGone(pick, gui.numbers, i));
       gui.numbers[i].setText("" + pick);
     }
   } else {
     for (int i = 0; i < 6; i++) {
       gui.numbers[i].setText(null);
     }
   }
 }
 public void itemStateChanged(ItemEvent event) {
   if (event.getStateChange() == ItemEvent.SELECTED) {
     int index = getSelectedIndex();
     int lower = _lower[index];
     int upper = _upper[index];
     MMultiplicity mult = null;
     if (lower >= 0) {
       mult = new MMultiplicity(lower, upper);
     }
     try {
       _setMethod.invoke(_container.getTarget(), new Object[] {mult});
     } catch (Exception e) {
       System.out.println(e.toString() + " in UMLMultiplicityComboBox.itemStateChanged()");
     }
   }
 }
Beispiel #28
0
 @Override
 public void itemStateChanged(ItemEvent ev) {
   if (ev.getStateChange() == ItemEvent.SELECTED) {
     SwingUtilities.invokeLater(
         new Runnable() {
           @Override
           public void run() {
             String newPainterName =
                 ((myjava.gui.syntax.Painter) (painterComboBox.getSelectedItem())).getName();
             cardLayout.show(centerPanel, newPainterName);
             centerPanel.revalidate();
             centerPanel.repaint();
           }
         });
   }
 }
Beispiel #29
0
    @Override
    public void itemStateChanged(ItemEvent e) {
      // TODO Auto-generated method stub
      Object source = e.getSource();
      Font tmp = example.getFont();
      int style = tmp.getStyle();

      if (source == italic)
        if (italic.isSelected()) style = style | Font.ITALIC; // turn italic on
        else style = style & ~Font.ITALIC; // turn italic off
      else if (source == bold)
        if (bold.isSelected()) style = style | Font.BOLD; // turn bold on
        else style = style & ~Font.BOLD; // turn bold off

      example.setFont(new Font(tmp.getFamily(), style, tmp.getSize()));
    }
    public void itemStateChanged(ItemEvent event) {
      CheckboxMenuItem theMenuItem = (CheckboxMenuItem) (event.getSource());

      String strIndex =
          theMenuItem
              .getActionCommand()
              .substring(theMenuItem.getActionCommand().lastIndexOf('.') + 1);
      int index = (new Integer(strIndex)).intValue();
      if (theMenuItem.getState()) {
        ((Component) visibleMapLayers.elementAt(index)).setVisible(true);
      } else {
        ((Component) visibleMapLayers.elementAt(index)).setVisible(false);
      }

      System.out.println("Action = " + theMenuItem.getActionCommand());
      System.out.println("       = " + theMenuItem.getState());
    }