Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
0
    /**
     * 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());
    }
Ejemplo 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;
      }
    }
  }
Ejemplo n.º 4
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;
   }
 }
Ejemplo n.º 5
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("");
      }
    }
  }
Ejemplo n.º 6
0
 @Override
 public void itemStateChanged(ItemEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == box) {
     getFindData();
   }
 }
Ejemplo n.º 7
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);
      }
    }
  }
Ejemplo n.º 8
0
    // 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();
    }
Ejemplo n.º 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();
           }
         });
   }
 }
Ejemplo n.º 10
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();
 }
Ejemplo n.º 11
0
 public void itemRemoved(ItemEvent itemEvent) {
   println("Item removed = " + itemEvent.getItem());
 }
Ejemplo n.º 12
0
 public void itemAdded(ItemEvent itemEvent) {
   println("Item added = " + itemEvent.getItem());
 }
Ejemplo n.º 13
0
 @Override
 public void itemStateChanged(ItemEvent e) {
   if (e.getSource() instanceof JRadioButton) checkUeberSchreib();
 }
 public void itemStateChanged(ItemEvent i) {
   if (i.getStateChange() == ItemEvent.SELECTED) co = (String) i.getItem();
   z = 1;
 }