Exemple #1
0
 public void itemStateChanged(ItemEvent event) {
   if (event.getSource() == compact) {
     updateDetailView();
   } else if (event.getSource() == showAll) {
     updateAllLists();
   }
 }
Exemple #2
0
    @Override
    public void itemStateChanged(ItemEvent e) {

      if (e.getSource() == coins) {

        if (e.getStateChange() == ItemEvent.SELECTED) {

          saveMask.setEnabled(true);

          Squeal.convertToCoins(true);

        } else {

          saveMask.setEnabled(false);

          Squeal.convertToCoins(false);
        }
      }

      if (e.getSource() == saveMask) {

        if (e.getStateChange() == ItemEvent.SELECTED) {

          Squeal.saveFishMasks(true);

        } else {

          Squeal.saveFishMasks(false);
        }
      }
    }
Exemple #3
0
        public void itemStateChanged(ItemEvent e) {
          if (e.getStateChange() == ItemEvent.SELECTED) {

            AdjuPopupPane popup =
                (AdjuPopupPane) relComponents[LABELS.adjudicationDisagreement.ordinal()];
            if (isParent) {
              String itemValue = (String) ((JComboBox) e.getSource()).getSelectedItem();
              if (itemValue.equals("Selected Annotator") || itemValue.equals("Select and Edit")) {
                String diff = relation.getAdjuDiff();
                popup.setAnnValue(diff);
                popup.setClickable(true);
                // relComponents[LABELS.adjudicationDisagreement.ordinal()}.
              } else {
                popup.annReset();
                popup.setClickable(false);
              }
            } else {
              popup.annReset();
              popup.setClickable(false);
            }

            mainFrame.inputAction((JComponent) e.getSource(), spanButtons);
            enableRelationType();
          }
        }
Exemple #4
0
  @Override
  public void itemStateChanged(ItemEvent e) {
    //		e.getItem();//状态
    System.out.println("e.getItem()           === " + e.getItem());
    //		e.paramString();//状态
    System.out.println("e.paramString()       === " + e.paramString());
    //		e.getItemSelectable();//选中对象,相当于是getSource
    System.out.println("e.getItemSelectable() === " + e.getItemSelectable());
    //		e.getStateChange();
    System.out.println("e.getStateChange()    === " + e.getStateChange());

    if (e.getStateChange() == ItemEvent.SELECTED) {
      if (e.getSource() == c4) {
        c4.setIcon(new ImageIcon(ClassLoader.getSystemResource("img2.jpg")));
      }
      if (e.getSource() == c5) {
        c5.setIcon(new ImageIcon(ClassLoader.getSystemResource("img2.jpg")));
      }
    } else {
      if (e.getSource() == c4) {
        c4.setIcon(new ImageIcon(ClassLoader.getSystemResource("img1.jpg")));
      }
      if (e.getSource() == c5) {
        c5.setIcon(new ImageIcon(ClassLoader.getSystemResource("img1.jpg")));
      }
    }
  }
 /** 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()
Exemple #6
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) {
    // 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);
      }
    }
  }
 public void itemStateChanged(ItemEvent e) {
   if (e.getSource() == chckbxDimensioniPersonalizzate) {
     enableCustomDimension(chckbxDimensioniPersonalizzate.isSelected());
   } else if (e.getSource() == landscape) {
     portrait.setSelected(!landscape.isSelected());
   } else if (e.getSource() == portrait) {
     landscape.setSelected(!portrait.isSelected());
   }
 }
Exemple #9
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) {
    if (e.getSource() instanceof JToggleButton) {
      JToggleButton toggleButton = (JToggleButton) e.getSource();

      if (toggleButton == jtbEmployeeActive) {
        actionEmpStatusStateChange();
      }
    }
  }
  @Override
  public void itemStateChanged(ItemEvent e) {
    if (e.getSource() instanceof JCheckBox) {
      JCheckBox checkBox = (JCheckBox) e.getSource();

      if (checkBox == jckShowPayDays) {
        itemStateChangedShowPayDays();
      }
    }
  }
 @Override
 public void itemStateChanged(ItemEvent e) {
   if (e.getSource() == constantTypeList) {
     int index = ((JComboBox) e.getSource()).getSelectedIndex();
     if (index == -1) {
       return;
     }
     updateConstList();
   }
 }
Exemple #13
0
  /**
   * When the chooser selection is changed, ensures that the Object is changed appropriately.
   *
   * @param e a value of type 'ItemEvent'
   */
  public void itemStateChanged(ItemEvent e) {
    String className = (String) m_ObjectChooser.getSelectedItem();
    //		m_editSourceBut.setEnabled(false);
    //		@todohannes: hack! ausbessern
    //		try {
    //			if (EvAClient.DYNAMICCLASSES_PROPERTIES.containsKey(className) && m_userdefclasses) {
    //				m_editSourceBut.setEnabled(true);
    //			}
    //		} catch (Exception e1) {
    //			System.out.println("Fehler !!! " + e1);
    //		}

    //		@todohannes: hack! ausbessern
    //
    //		if (this.m_SourceCodeEditorFrame != null) {
    //			m_SourceCodeEditorFrame.setVisible(false);
    //			m_SourceCodeEditorFrame = null;
    //			m_SourceCodeEditor = null;
    //		}

    if (TRACE) System.out.println("Event-Quelle: " + e.getSource().toString());
    if ((e.getSource() == m_ObjectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
      className = (String) m_ObjectChooser.getSelectedItem();
      try {
        //				if (EvAClient.DYNAMICCLASSES_PROPERTIES.containsKey(className) && m_userdefclasses) {
        //					Object[] para = new Object[] {};
        //					String source = EvAClient.DYNAMICCLASSES_PROPERTIES.getProperty(className);
        //					Object dummy = CompileAndLoad.getInstanceFull(source,className,para);
        //					setObject(dummy);
        //				} else {
        if (TRACE) System.out.println(className);
        //				Object n = (Object)Class.forName(className, true,
        // this.getClass().getClassLoader()).newInstance();
        Object n = (Object) Class.forName(className).newInstance();
        m_goe.setValue(n);
        // TODO ? setObject(n);
        //				}
      } catch (Exception ex) {
        System.err.println("Exeption in itemStateChanged " + ex.getMessage());
        System.err.println("Classpath is " + System.getProperty("java.class.path"));
        ex.printStackTrace();
        m_ObjectChooser.hidePopup();
        m_ObjectChooser.setSelectedIndex(0);
        JOptionPane.showMessageDialog(
            this,
            "Could not create an example of\n"
                + className
                + "\n"
                + "from the current classpath. Is the resource folder at the right place?\nIs the class abstract or the default constructor missing?",
            "GenericObjectEditor",
            JOptionPane.ERROR_MESSAGE);
        EVAHELP.getSystemPropertyString();
      }
    }
  }
  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;
      }
    }
  }
 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;
   }
 }
    /**
     * 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());
    }
Exemple #17
0
  public void itemStateChanged(ItemEvent evt) {

    Object item = evt.getItem();

    if (item.equals("Other") && evt.getSource().equals(this.obTypeCombo)) {

      this.objectOther.setEnabled(true);

    } else if (item.equals("Other") && evt.getSource().equals(this.methTypeCombo)) {

      this.methodOther.setEnabled(true);
    }
  }
		@Override
		public void itemStateChanged(ItemEvent e) {
			if (e.getStateChange() == ItemEvent.SELECTED) {
				if (penultimateSelection != null) {
					try {
						lock = true;
						penultimateSelection.setSelected(false); // deselect the tag selected first
					} finally {
						lock = false;
					}
				}
				penultimateSelection = ultimateSelection;
				ultimateSelection = (JCheckBox) e.getSource();
			} else { // compensate for manual deselection
				if (!lock) {
					Object source = e.getSource();
					if (source == penultimateSelection) {
						penultimateSelection = null;
					} else if (source == ultimateSelection) {
						ultimateSelection = penultimateSelection;
						penultimateSelection = null;
					}
				}
			}

			if (!lock) {

				int selCnt = 0;
				for (JCheckBox checkBox : checkBoxes) {
					if (checkBox.isSelected()) {
						selCnt++;
					}
				}

				boolean canCompare = (selCnt == 2);   // enable if two tags selected

				analyzeAction.setEnabled(canCompare);
				if (!canCompare) {
					compareOffRadio.setSelected(true);
				}
				compareOffRadio.setEnabled(canCompare);
				compareOnRadio.setEnabled(canCompare);

				if (canCompare && compareOnRadio.isSelected()) {
					fillModelFromDialog(getCurrentModel());
				}

			}


		}
 public void itemStateChanged(ItemEvent e) {
   ValueLabelItem item = (ValueLabelItem) e.getItem();
   if (e.getStateChange() == ItemEvent.SELECTED) {
     if (e.getSource() == lineThicknessBox) {
       annotation.getBorderStyle().setStrokeWidth((Float) item.getValue());
     } else if (e.getSource() == lineStyleBox) {
       annotation.getBorderStyle().setBorderStyle((Name) item.getValue());
     }
     // save the action state back to the document structure.
     updateCurrentAnnotation();
     currentAnnotationComponent.resetAppearanceShapes();
     currentAnnotationComponent.repaint();
   }
 }
Exemple #20
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) {
   if (e.getSource() instanceof JRadioButton) {
     if (e.getStateChange() == ItemEvent.SELECTED) {
       int[] si = getUserSelectedIndices();
       if (si != null && si.length == 1) {
         notifyChoicePicked(new MultipleChoiceEvent(MultipleChoice.this, si[0]));
       }
     }
   } else if (e.getSource() instanceof JCheckBox) {
     int[] si = getUserSelectedIndices();
     if (si != null) {
       notifyChoicePicked(new MultipleChoiceEvent(MultipleChoice.this, si));
     }
   }
 }
Exemple #22
0
 @Override
 public void itemStateChanged(ItemEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == box) {
     getFindData();
   }
 }
  public void itemStateChanged(ItemEvent e) {
    Object source = e.getSource();
    if (e.getStateChange() != ItemEvent.SELECTED) return;

    if (source == ncbGridTickX) {
      double val = ncbGridTickX.getValue();
      if (val > 0) {
        double[] ticks = view.getGridDistances();
        ticks[0] = val;
        view.setGridDistances(ticks);
      }
    } else if (source == ncbGridTickY) {
      double val = ncbGridTickY.getValue();
      if (val > 0) {
        double[] ticks = view.getGridDistances();
        ticks[1] = val;
        view.setGridDistances(ticks);
      }
    } else if (source == cbGridTickAngle) {
      double val = cbGridTickAngle.getSelectedIndex();
      if (val >= 0) {
        double[] ticks = view.getGridDistances();
        // val = 4 gives  5*PI/12, skip this and go to 6*Pi/2 = Pi/2
        if (val == 4) val = 5;
        ticks[2] = (val + 1) * Math.PI / 12;
        view.setGridDistances(ticks);
      }
    }

    view.updateBackground();
    updateGUI();
  }
  // ItemListener
  public void itemStateChanged(ItemEvent event) {
    if (event.getSource() == this.cbMeses) {
      if (!"Selecione...".equals(this.cbMeses.getSelectedItem())
          && this.cbMeses.getSelectedItem() != null) {
        for (Mes mesTemp : this.mesesDesignacoes) {
          if (this.cbMeses.getSelectedItem().equals(mesTemp.getMes().toString())
              || this.cbMeses
                  .getSelectedItem()
                  .equals(mesTemp.getMes().toString() + "/" + mesTemp.getAno())) {
            this.mesDesignacao = mesTemp;
            break;
          }
        }

        this.diasReuniao = this.gerenciador.obterDiasReuniaoSemanal(this.mesDesignacao);

        this.carregarMes();

      } else {
        if (this.scroll != null) {
          this.containerPanel.remove(this.scroll);
          this.scroll = null;
          this.btnSalvar.setVisible(false);
          this.revalidate();
          this.repaint();
        }
      }
    }
  }
Exemple #25
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 ev) {
   if (ev.getStateChange() == ItemEvent.SELECTED && ev.getSource() == cbSuspend) {
     int idx = cbSuspend.getSelectedIndex();
     tfThreadID.setEnabled(idx == CndBreakpoint.SUSPEND_THREAD);
     lThreadID.setEnabled(idx == CndBreakpoint.SUSPEND_THREAD);
   }
 }
  /**
   * Performs actions after specific Route is selected.
   *
   * @param ae - Route Object Tag value (String)
   */
  public void selectRouteAction(ItemEvent ae) {
    Item item = (Item) ((JComboBox) ae.getSource()).getSelectedItem();
    String routeTag = item.getId();
    Vector<Item> busDirectionItems = null;
    mainView.enableRefresh(false);

    try {
      busDirectionItems = mainModel.getBusDirectionItems(routeTag);

      if (busDirectionItems.size() > 0) {
        // Clear Out Bus Stops Table
        mainView.clearStops();

        // Populate Directions Combobox
        updateMapDirections(busDirectionItems);

        // Populate Directions Hash Map
        mainModel.setDirectionsMap(routeTag);

        // Draw Route on map
        drawMapRoute(routeTag);
      } else {
        mainView.enableRouteDirections(false);
      }
    } catch (ServiceUnavailableException e) {
      mainView.notifyAndExit(MainView.NEXTBUS_SERVICE_UNAVAILABLE);
    } catch (NullPointerException npe) {
      resetAll();
      // npe.printStackTrace();
    }
  }
  /*
   * The state of one of the following items has changed:
   * 1. bUseFTPCheckB check box: Enable or disable FTP setting fields given the state of the "Use FTP" checkbox
   * 2. autoFlushRB radio button: Enable or disable the Flush interval combo box
   */
  @Override
  public void itemStateChanged(ItemEvent eventI) {

    Object source = eventI.getSource();

    if (source == null) {
      return;
    } else if (source == bUseFTPCheckB) {
      boolean bChecked = bUseFTPCheckB.isSelected();
      ftpHostLabel.setEnabled(bChecked);
      ftpHostTF.setEnabled(bChecked);
      ftpUserLabel.setEnabled(bChecked);
      ftpUserTF.setEnabled(bChecked);
      ftpPasswordLabel.setEnabled(bChecked);
      ftpPasswordTF.setEnabled(bChecked);
    } else if (source == autoFlushRB) {
      if (autoFlushRB.isSelected()) {
        flushIntervalLabel.setEnabled(true);
        flushIntervalComboB.setEnabled(true);
      } else {
        flushIntervalLabel.setEnabled(false);
        flushIntervalComboB.setEnabled(false);
      }
    }
  }
Exemple #29
0
 /** Listens to the check box. */
 @Override
 public void itemStateChanged(ItemEvent e) {
   if (e.getSource().equals(getSmoothRB())) {
     // do nothing.
   }
   plot.setDataset(filterData(data));
 }
Exemple #30
-1
  /**
   * Invoked when an item has been selected or deselected by the user.
   *
   * <p>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).
   */
  public void itemStateChanged(ItemEvent e) {
    /* format menu */
    if (e.getSource() == wordWrap) {
      editor.setLineWrap(!editor.getLineWrap());
      side.setLineWrap(editor.getLineWrap());
      // wordWrap.setText(editor.getLineWrap() ? "Disable Word Wrap" : "Enable Word Wrap");
      wordWrap.setDisplayedMnemonicIndex(wordWrap.getText().indexOf('W'));
    }

    /* view menu */
    if (e.getSource() == toggleSide) {
      // hide the sidePane, sideButton, and update the text in the toggleSide JMenuItem (need to
      // update mnemonicindex as well)
      sidePane.setVisible(!sidePane.isVisible());
      sideButton.setVisible(sidePane.isVisible());
      // toggleSide.setText(sidePane.isVisible() ? "Hide Side Pane" : "Show Side Pane");
      toggleSide.setDisplayedMnemonicIndex(5);

      // easier to remove everything and then add them back
      centerPanel.removeAll();
      centerPanel.add(editorPane);
      if (sideButton.isVisible()) {
        centerPanel.add(sidePane);
      }
      centerPanel.validate();
    }
  }