本文整理汇总了Java中javax.swing.JTabbedPane.addChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java JTabbedPane.addChangeListener方法的具体用法?Java JTabbedPane.addChangeListener怎么用?Java JTabbedPane.addChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTabbedPane
的用法示例。
在下文中一共展示了JTabbedPane.addChangeListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initComponents
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void initComponents() {
this.setLayout(new BorderLayout(5, 5));
mainPanel = new JTabbedPane();
mainPanel.setBorder(title);
// Adds a change listener to perform gotFocus() and lostFocus() calls on wizardPanels
mainPanel.addChangeListener(new ChangeListener() {
/**
* Invoked when the target of the listener has changed its state.
*
* @param e a ChangeEvent object
*/
public void stateChanged(ChangeEvent e) {
// Lose focus on old panel
if (current != null) {
current.lostFocus();
}
// gets focus on new panel
if (mainPanel.getSelectedComponent() != null) {
current = (WizardPanel) mainPanel.getSelectedComponent();
current.gotFocus();
}
}
});
add(mainPanel, BorderLayout.CENTER);
}
示例2: addChangeListener
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
/**
* Adds the local ChangeListener named 'tabSelectionListener' to a JTabbedPane if not already there.
*
* @param pane the pane
*/
private void addChangeListener(JTabbedPane pane) {
boolean listenerFound = false;
ChangeListener[] listener = pane.getChangeListeners();
for (int i = 0; i < listener.length; i++) {
ChangeListener cl = listener[i];
if (cl == this.getTabSelectionListener()) {
listenerFound = true;
}
}
if (listenerFound == false) {
pane.addChangeListener(this.getTabSelectionListener());
}
}
示例3: areWeGettingMultipleSelects
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public void areWeGettingMultipleSelects() throws Throwable {
IDevice d = Device.getDevice();
final LoggingRecorder lr = new LoggingRecorder();
final JTabbedPane tp = (JTabbedPane) ComponentUtils.findComponent(JTabbedPane.class, frame);
Point p = getTabClickPoint(tp, 1);
d.click(tp, Buttons.LEFT, 1, p.x, p.y);
tp.addChangeListener(new ChangeListener() {
@Override public void stateChanged(ChangeEvent e) {
RTabbedPane rtp = new RTabbedPane(tp, null, null, lr);
rtp.stateChanged(e);
}
});
p = getTabClickPoint(tp, 2);
d.click(tp, Buttons.LEFT, 1, p.x, p.y);
AssertJUnit.assertEquals(1, lr.getCalls().size());
}
示例4: GysGuanLi
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public GysGuanLi() {
setIconifiable(true);
setClosable(true);
setTitle("��Ӧ�̹���");
JTabbedPane tabPane = new JTabbedPane();
final GysXiuGaiPanel spxgPanel = new GysXiuGaiPanel();
final GysTianJiaPanel sptjPanel = new GysTianJiaPanel();
tabPane.addTab("��Ӧ����Ϣ���", null, sptjPanel, "��Ӧ�����");
tabPane.addTab("��Ӧ����Ϣ����ɾ��", null, spxgPanel, "����ɾ��");
getContentPane().add(tabPane);
tabPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
spxgPanel.initComboBox();
}
});
pack();
setVisible(true);
}
示例5: KeHuGuanLi
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public KeHuGuanLi() {
setIconifiable(true);
setClosable(true);
setTitle("�ͻ���Ϣ����");
JTabbedPane tabPane = new JTabbedPane();
final KeHuXiuGaiPanel khxgPanel = new KeHuXiuGaiPanel();
final KeHuTianJiaPanel khtjPanel = new KeHuTianJiaPanel();
tabPane.addTab("�ͻ���Ϣ���", null, khtjPanel, "�ͻ����");
tabPane.addTab("�ͻ���Ϣ����ɾ��", null, khxgPanel, "����ɾ��");
getContentPane().add(tabPane);
tabPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
khxgPanel.initComboBox();
}
});
pack();
setVisible(true);
}
示例6: CzyGL
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public CzyGL() {
setIconifiable(true);
setClosable(true);
setBounds(100, 100, 491, 287);
setTitle("����Ա����");
JTabbedPane tabPane = new JTabbedPane();
final TJCzy tjPanel = new TJCzy();
final ShanChuCaoZuoYuan delPanel = new ShanChuCaoZuoYuan();
tabPane.addTab("��Ӳ���Ա", null, tjPanel, "��Ӳ���Ա");
tabPane.addTab("ɾ������Ա", null, delPanel, "ɾ������Ա");
getContentPane().add(tabPane);
tabPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
delPanel.initTable();
}
});
pack();
setVisible(true);
}
示例7: initDialog
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
void initDialog() {
dialog = new JDialog(
// dialog = new JFrame(
(JFrame)grid.getTopLevelAncestor(),
"Grid Rendering Tools");
tabs = new JTabbedPane(JTabbedPane.TOP);
tabs.add( "Rendering", this);
dialog.getContentPane().add(tabs);
JLabel label = new JLabel("Rendering tools are new "
+"and still under development - "
+"use with caution");
dialog.getContentPane().add(label, "South");
dialog.pack();
tabs.add( "3D", pers);
tabs.addChangeListener( new ChangeListener() {
public void stateChanged(ChangeEvent e) {
tabChange();
}
});
}
示例8: getUpperInfoPanel
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
@Override
protected JComponent getUpperInfoPanel() {
JTabbedPane result = this.upperInfoPanel;
if (result == null) {
this.upperInfoPanel = result = new JTabbedPane();
result.add(getLabelPanel());
if (getResourceKind().hasProperties()) {
JComponent propertiesPanel = getPropertiesPanel();
JScrollPane scrollPanel = new JScrollPane(propertiesPanel);
scrollPanel.setName(propertiesPanel.getName());
scrollPanel.getViewport()
.setBackground(propertiesPanel.getBackground());
result.add(scrollPanel);
result.addChangeListener(createInfoListener(true));
}
}
if (getResourceKind().hasProperties()) {
result.setSelectedIndex(getDisplay().getInfoTabIndex(true));
}
return result;
}
示例9: tabbedPaneFactory
import javax.swing.JTabbedPane; //导入方法依赖的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();
}
});
}
示例10: createNewTestDataTab
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private JTabbedPane createNewTestDataTab(TestData sTestData) {
JTabbedPane testdataTab = new JTabbedPane();
testdataTab.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
testdataTab.setTabPlacement(JTabbedPane.BOTTOM);
addToTab(testdataTab, sTestData.getGlobalData(), true);
for (AbstractDataModel std : sTestData.getTestDataList()) {
addToTab(testdataTab, std, false);
}
JLabel label = new JLabel("Click + to Add New TestData");
testdataTab.addTab("", ADD_NEW_TAB_ICON, label);
label.setHorizontalAlignment(JLabel.CENTER);
TabTitleEditListener l = new TabTitleEditListener(testdataTab, onTestDataRenameAction(), 0);
l.setOnMiddleClickAction(onCloseAction());
testdataTab.addChangeListener(l);
testdataTab.addMouseListener(l);
testdataTab.addChangeListener(this);
testdataTab.addMouseListener(onAddNewTDTab());
testdataTab.setComponentPopupMenu(testDataTabPopup);
return testdataTab;
}
示例11: init
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void init(Presenter explicitPresenter) {
presenters = makePresenters(explicitPresenter);
setLayout(new GridLayout(1, 1));
if (presenters.isEmpty()) {
throw new IllegalStateException("No presenter found"); //NOI18N
} else if (presenters.size() == 1) {
selectedPresenter = presenters.get(0).getPresenter();
add(selectedPresenter.getForm());
} else {
tabbedPane = new JTabbedPane();
for (PresenterProxy pp : presenters) {
Component tab = tabbedPane.add(pp.getForm());
if (pp.isInitialized()) {
tabbedPane.setSelectedComponent(tab);
selectedPresenter = pp.getPresenter();
}
}
tabbedPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
tabChanged();
}
});
add(tabbedPane);
}
if (selectedPresenter == null) {
chooseLastUsedPresenter();
}
newTabCheckBox = new JCheckBox(NbBundle.getMessage(SearchPanel.class,
"TEXT_BUTTON_NEW_TAB")); //NOI18N
newTabCheckBox.setMaximumSize(new Dimension(1000, 200));
newTabCheckBox.setSelected(
FindDialogMemory.getDefault().isOpenInNewTab());
initLocalStrings();
initAccessibility();
}
示例12: setupMode
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public void setupMode (DiffController view) {
JTabbedPane tabPane = findTabbedPane(view.getJComponent());
if (tabPane != null) {
if (!handledViews.containsKey(tabPane)) {
ChangeListener list = WeakListeners.change(this, tabPane);
handledViews.put(tabPane, list);
tabPane.addChangeListener(list);
}
if (tabPane.getTabCount() > diffViewMode) {
tabPane.setSelectedIndex(diffViewMode);
}
}
}
示例13: ZooInspectorNodeViewersPanel
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
/**
* @param zooInspectorManager
* - the {@link ZooInspectorManager} for the application
* @param nodeVeiwers
* - the {@link ZooInspectorNodeViewer}s to show
*/
public ZooInspectorNodeViewersPanel(
ZooInspectorNodeManager zooInspectorManager,
List<ZooInspectorNodeViewer> nodeVeiwers) {
this.zooInspectorManager = zooInspectorManager;
this.setLayout(new BorderLayout());
tabbedPane = new JTabbedPane(JTabbedPane.TOP,
JTabbedPane.WRAP_TAB_LAYOUT);
setNodeViewers(nodeVeiwers);
tabbedPane.addChangeListener(this);
this.add(tabbedPane, BorderLayout.CENTER);
reloadSelectedViewer();
}
示例14: MenuListener
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public MenuListener(JFrame mainContainer, GuiEventListener listener, JTabbedPane tabbedPane,
JList<String> firstListOfAnthills, JList<String> secondListOfAnthills, JList<String> thirdListOfAnthills,
JList<String> replays, JButton buttonStart, JRadioButton radioQualification,
JRadioButton radioTournamentSemiFinals, JScrollPane scrollPaneQualification,
JScrollPane scrollPaneTournament, JCheckBox runInBackgroundCheckbox) {
this.tabbedPane = tabbedPane;
this.buttonStart = buttonStart;
this.firstListOfAnthills = firstListOfAnthills;
this.secondListOfAnthills = secondListOfAnthills;
this.thirdListOfAnthills = thirdListOfAnthills;
this.replays = replays;
this.radioQualification = radioQualification;
this.radioTournamentSemiFinals = radioTournamentSemiFinals;
this.scrollPaneQualification = scrollPaneQualification;
this.scrollPaneTournament = scrollPaneTournament;
this.listener = listener;
this.runInBackgroundCheckbox = runInBackgroundCheckbox;
tabbedPane.addChangeListener(this);
firstListOfAnthills.addListSelectionListener(this);
secondListOfAnthills.addListSelectionListener(this);
thirdListOfAnthills.addListSelectionListener(this);
replays.addListSelectionListener(this);
buttonStart.addActionListener(this);
radioQualification.addActionListener(this);
radioTournamentSemiFinals.addActionListener(this);
}
示例15: initComponents
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void initComponents() {
this.setLayout(new BorderLayout(5, 5));
mainPanel = new JTabbedPane();
mainPanel.setBorder(title);
// Adds a change listener to perform gotFocus() and lostFocus() calls on wizardPanels
mainPanel.addChangeListener(new ChangeListener() {
/**
* Invoked when the target of the listener has changed its state.
*
* @param e a ChangeEvent object
*/
public void stateChanged(ChangeEvent e) {
// Lose focus on old panel
if (current != null) {
current.lostFocus();
}
// gets focus on new panel
if (mainPanel.getSelectedComponent() != null) {
current = (WizardPanel) mainPanel.getSelectedComponent();
current.gotFocus();
}
}
});
add(mainPanel, BorderLayout.CENTER);
}