Java 类javax.swing.event.ChangeListener 实例源码

项目:Reer    文件:MainGradlePanel.java   
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());
            }
        }
    });
}
项目:ObsidianSuite    文件:TimelinePartPanel.java   
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()));
            }
        }
    });
}
项目:Hotel-Properties-Management-System    文件:HotelPropertiesWindow.java   
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;
}
项目:java-course    文件:JNotepadPP.java   
/**
 * 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();
        }

    });
}
项目:jmt    文件:SemaphoreEditor.java   
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);
        }
    });
}
项目:incubator-netbeans    文件:VCSVisibilityQueryTest.java   
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);
    }
}
项目:incubator-netbeans    文件:ComponentPeerTest.java   
public synchronized void fireChangeEvent() {
    ChangeEvent e = new ChangeEvent(this);

    for (ChangeListener l : listeners) {
        l.stateChanged(e);
    }
}
项目:org.alloytools.alloy    文件:PreferencesDialog.java   
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;
}
项目:incubator-netbeans    文件:MoveMembersUI.java   
@Override
public CustomRefactoringPanel getPanel(ChangeListener parent) {
    if (panel == null) {
        panel = new MoveMembersPanel(selectedElements, parent);
    }
    return panel;
}
项目:chipKIT-importer    文件:ProgressTrackingStep.java   
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);
    }
}
项目:Hotel-Properties-Management-System    文件:ReservedCheckinWindow.java   
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;
    }
项目:incubator-netbeans    文件:MemoryResultsPanel.java   
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);
}
项目:incubator-netbeans    文件:AttachPanel.java   
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);
}
项目:incubator-netbeans    文件:Actions.java   
/**
 * 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;
}
项目:incubator-netbeans    文件:MainClassChooser.java   
public void removeChangeListener (ChangeListener l) {
    changeListener = null;
}
项目:incubator-netbeans    文件:DocumentViewModel.java   
public void addChangeListener(ChangeListener l) {
    changeSupport.addChangeListener(l);
}
项目:incubator-netbeans    文件:TemplateWizardIterator.java   
@Override
public void removeChangeListener(ChangeListener l) {
    delegateIterator.removeChangeListener(l);
}
项目:incubator-netbeans    文件:HTMLPanel.java   
@Override
public void addChangeListener(ChangeListener l) {
}
项目:incubator-netbeans    文件:FilterPropertyProvider.java   
public final synchronized void removeChangeListener(ChangeListener listener) {
    cs.removeChangeListener(listener);
}
项目:incubator-netbeans    文件:FxmlParser.java   
@Override
public void addChangeListener(ChangeListener changeListener) {
}
项目:incubator-netbeans    文件:YamlParser.java   
@Override
public void removeChangeListener(ChangeListener changeListener) {
    // FIXME parsing API
}
项目:incubator-netbeans    文件:SnapshotMemLeakTest.java   
@Override
public void addChangeListener(ChangeListener changeListener) {
}
项目:incubator-netbeans    文件:AbstractHelp.java   
public final void removeChangeListener(ChangeListener l) {
    cs.removeChangeListener(l);
}
项目:incubator-netbeans    文件:HibernateRevengDatabaseTablesPanel.java   
public void addChangeListener(ChangeListener listener) {
    changeSupport.addChangeListener(listener);
}
项目:incubator-netbeans    文件:BrokenProjectAnnotator.java   
@Override
public void addChangeListener(@NonNull final ChangeListener listener) {
    Parameters.notNull("listener", listener);   //NOI18N
    changeSupport.addChangeListener(listener);

}
项目:incubator-netbeans    文件:BasicProjectInfoWizardPanel.java   
public final void removeChangeListener(ChangeListener l) {
    cs.removeChangeListener(l);
}
项目:incubator-netbeans    文件:ClasspathWizardPanel.java   
public final void addChangeListener(ChangeListener l) {
    cs.addChangeListener(l);
}
项目:incubator-netbeans    文件:NashornPlatform.java   
public void removeChangeListener(ChangeListener chl) {
    synchronized (listeners) {
        listeners.remove(chl);
    }
}
项目:incubator-netbeans    文件:SelectionModel.java   
public void removeChangeListener( ChangeListener cl ) {
    changeSupport.removeChangeListener( cl );
}
项目:incubator-netbeans    文件:Clusterize.java   
@Override
public void addChangeListener(ChangeListener l) {
}
项目:incubator-netbeans    文件:SourceFileObjectTest.java   
public void addChangeListener(ChangeListener listener) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:Pogamut3    文件:TemplateBotProjectWizardPanel.java   
@Override
public final void addChangeListener(ChangeListener l) {
    synchronized (listeners) {
        listeners.add(l);
    }
}
项目:incubator-netbeans    文件:DerbyDatabasesImpl.java   
public  void removeChangeListener(ChangeListener listener) {
    changeListeners.remove(listener);
}
项目:incubator-netbeans    文件:Controller.java   
public void addSelectionChangeListener( ChangeListener listener ) {
    selectionModel.addChangeListener( listener );
}
项目:incubator-netbeans    文件:AccessibilityQuery.java   
/**
 * 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);
}
项目:incubator-netbeans    文件:FxmlParser.java   
@Override
public void removeChangeListener(ChangeListener changeListener) {
}
项目:openjdk-jdk10    文件:CaretFloatingPointAPITest.java   
@Override
public void removeChangeListener(ChangeListener l) {
}
项目:incubator-netbeans    文件:ChoosingConnectionNamePanel.java   
public final void removeChangeListener(ChangeListener l) {
    synchronized (listeners) {
        listeners.remove(l);
    }
}
项目:incubator-netbeans    文件:RendererFactory.java   
/** Overridden to do nothing */
public void addChangeListener(ChangeListener cl) {
}
项目:incubator-netbeans    文件:DependenciesNode.java   
public void removeChangeListener(ChangeListener listener) {
    cs.addChangeListener(listener);
}