Exemplo n.º 1
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();
        }
      }
    }
Exemplo n.º 2
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);
   }
 }
Exemplo n.º 3
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;
      }
    }
  }
Exemplo n.º 4
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("");
      }
    }
  }
Exemplo n.º 6
0
 @Override
 public void itemStateChanged(ItemEvent e) {
   if (e.getItem() == PerfMeasureType.CUSTOM) mAddPerfMeasures.setVisible(true);
   else {
     mAddPerfMeasures.setVisible(false);
     mTypeToWeight.clear();
   }
 }
Exemplo n.º 7
0
  public void itemStateChanged(ItemEvent ie) {

    if (ie.getSource() == c1) {
      String s = c1.getLabel();
      g = s;
    } else {
      String s = c2.getLabel();
      g = s;
    }
  }
Exemplo n.º 8
0
  @Override
  public void itemStateChanged(ItemEvent e) {
    p.setFocus();

    if (e.getStateChange() == ItemEvent.SELECTED) {
      p.getR().hardMode(true);
    } else {
      p.getR().hardMode(false);
    }
  }
Exemplo n.º 9
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);
      }
    }
  }
Exemplo n.º 10
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();
   }
 }
Exemplo n.º 11
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;
    }
  }
Exemplo n.º 12
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()));
    }
Exemplo n.º 13
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();
           }
         });
   }
 }
Exemplo n.º 14
0
 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);
     }
   }
 }
Exemplo n.º 15
0
 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()");
     }
   }
 }
Exemplo n.º 16
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();
    }
  }
Exemplo n.º 17
0
    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());
    }
Exemplo n.º 18
0
 // Item Listener stuff
 public void showMessages(ItemEvent e) {
   int index = 0;
   if (e != null) index = ((Integer) e.getItem()).intValue();
   allmessagesTextArea.setText("");
   TracesSession tS = tracesSessions.elementAt(index);
   for (int i = 0; i < tS.size(); i++) {
     TracesMessage tM = tS.elementAt(i);
     // allmessagesTextArea.setForeground(Color.red);
     // allmessagesTextArea.setFont(new Font ("Dialog", 1, 18));
     allmessagesTextArea.append(
         "Message " + (i + 1) + " from " + tM.getFrom() + " to " + tM.getTo());
     allmessagesTextArea.append("\n\n");
     // allmessagesTextArea.setForeground(Color.black);
     // allmessagesTextArea.setFont(new Font ("Dialog", 1, 14));
     allmessagesTextArea.append(tM.getMessageString());
     allmessagesTextArea.append("\n");
   }
   allmessagesTextArea.select(0, 0);
 }
Exemplo n.º 19
0
    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));
    }
 public void itemStateChanged(ItemEvent e) {
   Object obj = e.getSource();
   if (obj == choice) {
     graph.newStat = true;
     if (choice.getSelectedItem().equals("Show Sequences")) {
       if (graph.originX * graph.originX + graph.originY * graph.originY < 9) {
         graph.originX = 40.0;
         graph.originY = 2 * Math.PI;
         graph.setZoom(15);
       }
     } else {
       if (graph.originX * graph.originX + graph.originY * graph.originY > 9) {
         graph.originX = 0.0;
         graph.originY = 0.0;
         graph.setZoom(11);
       }
     }
     graph.repaint();
   }
 }
Exemplo n.º 21
0
  @Override
  public void itemStateChanged(ItemEvent e) {
    if (e.getSource() == increment) {
      if (startedFilterSearch || startedFloatSearch) {
        clearSearch();
      }
      updateSearchButtonText();

      // Make sure the correct key listener is activated:
      updateKeyListeners();

    } else /*if (e.getSource() == normal)*/ {
      updateSearchButtonText();

      // If this search type is disabled, remove reordering from
      // all databases.
      /*if ((panel != null) && increment.isSelected()) {
          clearSearch();
      } */
    }
  }
Exemplo n.º 22
0
 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);
   }
 }
Exemplo n.º 23
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();
 }
 public void itemStateChanged(ItemEvent i) {
   if (i.getStateChange() == ItemEvent.SELECTED) co = (String) i.getItem();
   z = 1;
 }
Exemplo n.º 25
0
    public void itemStateChanged(ItemEvent e) {
      if (e.getStateChange() != ItemEvent.SELECTED) return;

      final Project selectedProject = (Project) e.getItem();
      if (selectedProject.isValid()) issueLoader.setProject(selectedProject);
    }
 // Implementation of stateChanged
 public void itemStateChanged(ItemEvent e) {
   if (e.getSource() == allfieldcheckbox) {
     update();
   }
 }
Exemplo n.º 27
0
 public void itemStateChanged(ItemEvent evt) {
   // only on 'selection' event
   if (evt.getStateChange() == ItemEvent.SELECTED) {
     clOptions.show(pOptions, types[cbType.getSelectedIndex()]);
   }
 }
 public void itemStateChanged(ItemEvent e) {
   if (e.getSource() == combo1) {
     String seleccionado = (String) combo1.getSelectedItem();
     setTitle(seleccionado);
   }
 }
Exemplo n.º 29
0
 @Override
 public void itemStateChanged(ItemEvent e) {
   if (e.getSource() instanceof JRadioButton) checkUeberSchreib();
 }
Exemplo n.º 30
0
 public void itemStateChanged(ItemEvent e) {
   PlayerType ptype = (PlayerType) e.getItem();
   CardLayout cl = (CardLayout) mTabs.getLayout();
   assert (cl.getClass() == CardLayout.class);
   cl.show(mTabs, ptype.toString());
 }