private void setupUI() { setLayout(new BorderLayout()); tabbedPane = new JTabbedPane(); add(tabbedPane, BorderLayout.CENTER); addTabs(); restoreLastTab(); //add a listener so we can store the current tab when it changes. tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { int selection = tabbedPane.getSelectedIndex(); if (selection >= 0 && selection < gradleTabs.size()) { SettingsNode rootNode = settings.addChildIfNotPresent(MAIN_PANEL); rootNode.setValueOfChild(CURRENT_TAB, gradleTabs.get(selection).getName()); } } }); }
private PartSpinner(int dimension) { super(new PartSpinnerModel()); this.dimension = dimension; setupFilter(); addChangeListener(new ChangeListener(){ @Override public void stateChanged(ChangeEvent e) { Part part = controller.getSelectedPart(); PartSpinner spinner = (PartSpinner) e.getSource(); if(part != null && ((JSpinner.DefaultEditor)getEditor()).getTextField().hasFocus()) { double d = (double) spinner.getValue(); float[] prevValues = part.getValues(); part.setValue((float) d, dimension); controller.mainController.versionController.applyChange(new ChangeSetValues(prevValues, part.getValues(), part.getName(), (int) controller.getTime())); } } }); }
private ChangeListener setTypeFields() { ChangeListener changeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int count = (int) roomTypeSpinner.getValue(); if (count > typeValue) { for (int i = 0; i < count; i++) { roomTypeFields[i].setVisible(true); roomTypeFields[i].revalidate(); roomTypeFields[i].repaint(); } } else if (count < typeValue) { roomTypeFields[count].setVisible(false); roomTypeFields[count].revalidate(); roomTypeFields[count].repaint(); } typeValue = count; } }; return changeListener; }
/** * Creates new {@link JTabbedPane} with {@link ChangeListener}. */ private void tabbedPaneFactory() { tabs = new JTabbedPane(); tabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); tabs.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int index = tabs.getSelectedIndex(); activeEditor = editors.get(index); if (editors.size() > 1) { activeEditor.updateStatusBar(); } updateFrameTitle(); } }); }
private void updateSpinner() { jNumField.setValue(threshold); jNumField.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Integer i = (Integer) jNumField.getValue(); if (i.intValue() < 1) { i = new Integer(1); jNumField.setValue(i); } SemaphoreStrategy ss = (SemaphoreStrategy) stations.getSemaphoreStrategy(stationKey, classKey); ss.setThreshold(i); } }); }
public void testFireForFiles() throws IOException { final List<String> received = new ArrayList<String>(); ChangeListener list; VisibilityQuery.getDefault().addChangeListener(list = new ChangeListener() { @Override public void stateChanged(ChangeEvent ce) { Assert.assertTrue(ce instanceof VisibilityQueryChangeEvent); FileObject[] fos = ((VisibilityQueryChangeEvent)ce).getFileObjects(); Assert.assertEquals(2, fos.length); received.add(fos[0].getName()); received.add(fos[1].getName()); } }); try { File f1 = createVersionedFile("f1", true); File f2 = createVersionedFile("f2", true); TestVCS.getInstance().getVisibilityQuery().fireVisibilityChanged( new VCSFileProxy[] { VCSFileProxy.createFileProxy(f1), VCSFileProxy.createFileProxy(f2)}); assertTrue(received.contains(f1.getName())); assertTrue(received.contains(f2.getName())); } finally { VisibilityQuery.getDefault().removeChangeListener(list); } }
public synchronized void fireChangeEvent() { ChangeEvent e = new ChangeEvent(this); for (ChangeListener l : listeners) { l.stateChanged(e); } }
protected JCheckBox mkCheckBox(final BooleanPref pref) { final JCheckBox cb = make(new JCheckBox(pref.getTitleAction())); pref2comp.put(pref, cb); ChangeListener ctrl = new ChangeListener() { public void stateChanged(ChangeEvent e) { cb.setSelected(pref.get()); } }; pref.addChangeListener(ctrl); ctrl.stateChanged(null); return cb; }
@Override public CustomRefactoringPanel getPanel(ChangeListener parent) { if (panel == null) { panel = new MoveMembersPanel(selectedElements, parent); } return panel; }
private void fireChangeEvent() { Iterator<ChangeListener> it; synchronized (listeners) { it = new HashSet<>(listeners).iterator(); } ChangeEvent ev = new ChangeEvent(this); while (it.hasNext()) { it.next().stateChanged(ev); } }
private ChangeListener customerCounterListener() { final ChangeListener spinnerListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { switch ((int) spinner.getValue()) { case 1: contentPanel.removeAll(); contentPanel.add(upperPanel, BorderLayout.NORTH); contentPanel.add(customerFormOne.setCustomerDetailPanel(), BorderLayout.WEST); contentPanel.revalidate(); contentPanel.repaint(); break; case 2: contentPanel.removeAll(); contentPanel.add(upperPanel, BorderLayout.NORTH); contentPanel.add(customerFormOne.setCustomerDetailPanel(), BorderLayout.WEST); contentPanel.add(customerFormTwo.setCustomerDetailPanel(), BorderLayout.EAST); contentPanel.revalidate(); contentPanel.repaint(); break; case 3: contentPanel.removeAll(); contentPanel.add(upperPanel, BorderLayout.NORTH); contentPanel.add(customerFormOne.setCustomerDetailPanel(), BorderLayout.WEST); contentPanel.add(customerFormTwo.setCustomerDetailPanel(), BorderLayout.EAST); contentPanel.add(customerFormThree.setCustomerDetailPanel(), BorderLayout.CENTER); contentPanel.revalidate(); contentPanel.repaint(); break; default: break; } } }; return spinnerListener; }
private void initFilterPanel() { filterComponent = FilterComponent.create(true, true); filterComponent.setHint(CLASS_NAME_FILTER); filterComponent.setFilter(filterString, filterType); filterComponent.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { String selectedRowContents = null; int selectedRow = resTable.getSelectedRow(); if (selectedRow != -1) { selectedRowContents = (String) resTable.getValueAt(selectedRow, 0); } filterString = filterComponent.getFilterValue(); filterType = filterComponent.getFilterType(); createFilteredIndexes(); resTable.invalidate(); jScrollPane.revalidate(); resTable.repaint(); if (selectedRowContents != null) { resTable.selectRowByContents(selectedRowContents, 0, true); } } }); add(filterComponent.getComponent(), BorderLayout.SOUTH); }
public AttachPanel(ChangeListener issueListener, FileObject referenceFile) { initComponents(); qs = IssueQuickSearch.create(referenceFile); qs.setEnabled(false); qs.setChangeListener(issueListener); qs.setChangeListener(this); issuePanel.add(qs.getComponent(), BorderLayout.NORTH); enableFields(false); }
/** * Create action for changing scheduling info for supplied nodes. * * <p> * If one of the nodes does not support schedule handling, the action is disabled!</p> * * @param nodes * @return */ private static Action getScheduleAction(final TaskNode... taskNodes) { // Check the selected nodes - if one of the selected nodes does not // support scheduling - don't offer it in the menu boolean hasSchedule = true; for (TaskNode tn : taskNodes) { if (!tn.getTask().hasSchedule()) { hasSchedule = false; break; } } IssueScheduleInfo schedule = null; if (taskNodes.length == 1) { schedule = taskNodes[0].getTask().getSchedule(); } final DashboardUtils.SchedulingMenu scheduleMenu = DashboardUtils.createScheduleMenu(schedule); //TODO weak listener?? final ChangeListener listener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { for (TaskNode taskNode : taskNodes) { if (taskNode.getTask().hasSchedule()) { taskNode.getTask().setSchedule(scheduleMenu.getScheduleInfo()); } } scheduleMenu.removeChangeListener(this); } }; scheduleMenu.addChangeListener(listener); Action menuAction = scheduleMenu.getMenuAction(); menuAction.setEnabled(hasSchedule); return menuAction; }
public void removeChangeListener (ChangeListener l) { changeListener = null; }
public void addChangeListener(ChangeListener l) { changeSupport.addChangeListener(l); }
@Override public void removeChangeListener(ChangeListener l) { delegateIterator.removeChangeListener(l); }
@Override public void addChangeListener(ChangeListener l) { }
public final synchronized void removeChangeListener(ChangeListener listener) { cs.removeChangeListener(listener); }
@Override public void addChangeListener(ChangeListener changeListener) { }
@Override public void removeChangeListener(ChangeListener changeListener) { // FIXME parsing API }
public final void removeChangeListener(ChangeListener l) { cs.removeChangeListener(l); }
public void addChangeListener(ChangeListener listener) { changeSupport.addChangeListener(listener); }
@Override public void addChangeListener(@NonNull final ChangeListener listener) { Parameters.notNull("listener", listener); //NOI18N changeSupport.addChangeListener(listener); }
public final void addChangeListener(ChangeListener l) { cs.addChangeListener(l); }
public void removeChangeListener(ChangeListener chl) { synchronized (listeners) { listeners.remove(chl); } }
public void removeChangeListener( ChangeListener cl ) { changeSupport.removeChangeListener( cl ); }
public void addChangeListener(ChangeListener listener) { throw new UnsupportedOperationException("Not supported yet."); }
@Override public final void addChangeListener(ChangeListener l) { synchronized (listeners) { listeners.add(l); } }
public void removeChangeListener(ChangeListener listener) { changeListeners.remove(listener); }
public void addSelectionChangeListener( ChangeListener listener ) { selectionModel.addChangeListener( listener ); }
/** * Removes a {@link ChangeListener}. * @param listener the listener to be removed */ public void removeChangeListener(@NonNull final ChangeListener listener) { Parameters.notNull("listener", listener); //NOI18N listeners.removeChangeListener(listener); }
@Override public void removeChangeListener(ChangeListener changeListener) { }
@Override public void removeChangeListener(ChangeListener l) { }
public final void removeChangeListener(ChangeListener l) { synchronized (listeners) { listeners.remove(l); } }
/** Overridden to do nothing */ public void addChangeListener(ChangeListener cl) { }
public void removeChangeListener(ChangeListener listener) { cs.addChangeListener(listener); }