/** 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()
/** * 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()); }
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(); } } }
/** 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); }
@Override public void itemStateChanged(ItemEvent e) { if (e.getItem() == PerfMeasureType.CUSTOM) mAddPerfMeasures.setVisible(true); else { mAddPerfMeasures.setVisible(false); mTypeToWeight.clear(); } }
// 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); }
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() != ItemEvent.SELECTED) return; final Project selectedProject = (Project) e.getItem(); if (selectedProject.isValid()) issueLoader.setProject(selectedProject); }
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()); }
public void itemStateChanged(ItemEvent i) { if (i.getStateChange() == ItemEvent.SELECTED) co = (String) i.getItem(); z = 1; }
public void itemStateChanged(ItemEvent e) { texta.setText( lblName.getText() + text0.getText() + '\n' + lblAcad.getText() + e.getItem()); }