コード例 #1
0
 @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);
   }
 }
コード例 #2
0
ファイル: MixingColors.java プロジェクト: theraptor42/CS-102
    public void itemStateChanged(ItemEvent ie) {
      if (ie.getSource() == red) {
        if (ie.getStateChange() == ItemEvent.SELECTED) redValue = 255;
        else redValue = 0;
      } else if (ie.getSource() == green) {
        if (ie.getStateChange() == ItemEvent.SELECTED) greenValue = 255;
        else greenValue = 0;
      } else if (ie.getSource() == blue) {
        if (ie.getStateChange() == ItemEvent.SELECTED) blueValue = 255;
        else blueValue = 0;
      }

      label.setBackground(new Color(redValue, greenValue, blueValue));
    }
コード例 #3
0
  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("");
      }
    }
  }
コード例 #4
0
    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();
        }
      }
    }
コード例 #5
0
ファイル: QP4_PriceDistance.java プロジェクト: ChonC/SPA
 /** 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);
     }
   }
 }
コード例 #6
0
ファイル: ButtonToolBar.java プロジェクト: yegor86/whiteboard
 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();
   }
 }
コード例 #7
0
  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;
    }
  }
コード例 #8
0
 public void itemStateChanged(ItemEvent evt) {
   if (evt.getSource() instanceof JOAJRadioButton) {
     JOAJRadioButton rb = (JOAJRadioButton) evt.getSource();
     if (rb == b1 && evt.getStateChange() == ItemEvent.SELECTED) {
       mOffset = JOAConstants.PROFSEQUENCE;
       setXRangeToSequence();
     } else if (rb == b2 && evt.getStateChange() == ItemEvent.SELECTED) {
       mOffset = JOAConstants.PROFDISTANCE;
       setXRangeToDistance();
     } else if (rb == b3 && evt.getStateChange() == ItemEvent.SELECTED) {
       mOffset = JOAConstants.PROFTIME;
       setXRangeToTime();
     }
   } else if (evt.getSource() instanceof JOAJCheckBox) {
   } else if (evt.getSource() instanceof JOAJComboBox) {
     JOAJComboBox cb = (JOAJComboBox) evt.getSource();
     if (cb == presetColorSchemes) {
       int colorScheme = cb.getSelectedIndex();
       if (colorScheme == 0) {
         // default bg
         plotBg.setColor(JOAConstants.DEFAULT_CONTENTS_COLOR);
         axesColor.setColor(Color.black);
       } else if (colorScheme == 1) {
         // white bg
         plotBg.setColor(Color.white);
         axesColor.setColor(Color.black);
       } else {
         // color bg
         plotBg.setColor(Color.black);
         axesColor.setColor(Color.white);
       }
     } else if (cb == mSymbolPopup) {
       mCurrSymbol = cb.getSelectedIndex() + 1;
     }
   }
   generatePlotName();
 }
コード例 #9
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();
           }
         });
   }
 }
コード例 #10
0
 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());
 }
コード例 #11
0
  private void cmbLagerItemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {

      vorratsListeInsLogbuch();

      ziel = (Lager) cmbLager.getSelectedItem();
      Tools.log(txtLog, "=================================================================");
      Tools.log(txtLog, "Ab jetzt wird ins Lager: \"" + ziel.getBezeichnung() + "\" umgebucht.");
      Tools.log(txtLog, "=================================================================");
      Main.getProps()
          .put(
              "touch" + MODULENUMBER + "lager",
              new Integer(cmbLager.getSelectedIndex()).toString());
      loadVorratTable();
      txtSearch.requestFocus();
    }
  }
コード例 #12
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);
      }
    }
  }
コード例 #13
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.");
      }
    }
 public void itemStateChanged(ItemEvent i) {
   if (i.getStateChange() == ItemEvent.SELECTED) co = (String) i.getItem();
   z = 1;
 }
コード例 #15
0
 public void itemStateChanged(ItemEvent evt) {
   // only on 'selection' event
   if (evt.getStateChange() == ItemEvent.SELECTED) {
     clOptions.show(pOptions, types[cbType.getSelectedIndex()]);
   }
 }
コード例 #16
0
    public void itemStateChanged(ItemEvent e) {
      if (e.getStateChange() != ItemEvent.SELECTED) return;

      final Project selectedProject = (Project) e.getItem();
      if (selectedProject.isValid()) issueLoader.setProject(selectedProject);
    }
コード例 #17
0
 @Override
 public void itemStateChanged(ItemEvent event) {
   if (event.getStateChange() == ItemEvent.SELECTED)
     gui.getTestText().setForeground(FontManager.COLORS[gui.getBox().getSelectedIndex()]);
 }
コード例 #18
0
ファイル: Options.java プロジェクト: TAChapman/Agh
 public void itemStateChanged(ItemEvent ev) {
   boolean selected = (ev.getStateChange() == ItemEvent.SELECTED);
   AbstractButton button = (AbstractButton) ev.getItemSelectable();
   String command = button.getActionCommand();
 }