当前位置: 首页>>代码示例>>Java>>正文


Java ChangeListener类代码示例

本文整理汇总了Java中javax.swing.event.ChangeListener的典型用法代码示例。如果您正苦于以下问题:Java ChangeListener类的具体用法?Java ChangeListener怎么用?Java ChangeListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChangeListener类属于javax.swing.event包,在下文中一共展示了ChangeListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupUI

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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());
            }
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:22,代码来源:MainGradlePanel.java

示例2: PartSpinner

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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()));
			}
		}
	});
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:19,代码来源:TimelinePartPanel.java

示例3: setTypeFields

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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;
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:24,代码来源:HotelPropertiesWindow.java

示例4: tabbedPaneFactory

import javax.swing.event.ChangeListener; //导入依赖的package包/类
/**
 * 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();
        }

    });
}
 
开发者ID:fgulan,项目名称:java-course,代码行数:21,代码来源:JNotepadPP.java

示例5: updateSpinner

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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);
		}
	});
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:16,代码来源:SemaphoreEditor.java

示例6: testFireForFiles

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:VCSVisibilityQueryTest.java

示例7: fireChangeEvent

import javax.swing.event.ChangeListener; //导入依赖的package包/类
public synchronized void fireChangeEvent() {
    ChangeEvent e = new ChangeEvent(this);
    
    for (ChangeListener l : listeners) {
        l.stateChanged(e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ComponentPeerTest.java

示例8: mkCheckBox

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:13,代码来源:PreferencesDialog.java

示例9: getPanel

import javax.swing.event.ChangeListener; //导入依赖的package包/类
@Override
public CustomRefactoringPanel getPanel(ChangeListener parent) {
    if (panel == null) {
        panel = new MoveMembersPanel(selectedElements, parent);
    }
    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:MoveMembersUI.java

示例10: fireChangeEvent

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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);
    }
}
 
开发者ID:chipKIT32,项目名称:chipKIT-importer,代码行数:11,代码来源:ProgressTrackingStep.java

示例11: customerCounterListener

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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;
	}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:39,代码来源:ReservedCheckinWindow.java

示例12: initFilterPanel

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:MemoryResultsPanel.java

示例13: AttachPanel

import javax.swing.event.ChangeListener; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:AttachPanel.java

示例14: getScheduleAction

import javax.swing.event.ChangeListener; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:44,代码来源:Actions.java

示例15: removeChangeListener

import javax.swing.event.ChangeListener; //导入依赖的package包/类
public void removeChangeListener (ChangeListener l) {
    changeListener = null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:MainClassChooser.java


注:本文中的javax.swing.event.ChangeListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。