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


Java JTabbedPane.setSelectedIndex方法代码示例

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


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

示例1: buildControlPanel

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
@Override
public JPanel buildControlPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    final JTabbedPane pane = new JTabbedPane();
    pane.addTab("Basic controls", basicTab = new CochleaAMS1cBasicPanel(CochleaAMS1c.this));      //creates a new basic (user friendly) panel
    pane.addTab("Expert controls", expertTab = new CochleaAMS1cControlPanel(CochleaAMS1c.this));  //creates a new expert panel with all biases
    panel.add(pane, BorderLayout.CENTER);
    pane.setSelectedIndex(getPrefs().getInt("CochleaAMS1c.selectedBiasgenControlTab", 0));
    pane.addMouseListener(new java.awt.event.MouseAdapter() {

    @Override
    public void mouseClicked(java.awt.event.MouseEvent evt) {
         getPrefs().putInt("CochleaAMS1c.selectedBiasgenControlTab", pane.getSelectedIndex());
    }
    });

            return panel;

   // CochleaAMS1cControlPanel myControlPanel = new CochleaAMS1cControlPanel(CochleaAMS1c.this);
   // return myControlPanel;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:CochleaAMS1c.java

示例2: TabbedPaneDemo

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public TabbedPaneDemo() {
    ImageIcon icon = new ImageIcon("images/middle.gif");
    JTabbedPane tabbedPane = new JTabbedPane();

    Component panel1 = makeTextPanel("Blah");
    tabbedPane.addTab("One", icon, panel1, "Does nothing");
    tabbedPane.setSelectedIndex(0);

    Component panel2 = makeTextPanel("Blah blah");
    tabbedPane.addTab("Two", icon, panel2, "Does twice as much nothing");

    Component panel3 = makeTextPanel("Blah blah blah");
    tabbedPane.addTab("Three", icon, panel3, "Still does nothing");

    Component panel4 = makeTextPanel("Blah blah blah blah");
    tabbedPane.addTab("Four", icon, panel4, "Does nothing at all");

    //Add the tabbed pane to this panel.
    setLayout(new GridLayout(1, 1));
    add(tabbedPane);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:TabbedPaneDemo.java

示例3: 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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:22,代码来源:GraphEditorTab.java

示例4: buildControlPanel

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
@Override
public JPanel buildControlPanel() {     //added new control panel for AMS1b, similiar look as DVS128 control panel @philipp
                  JPanel panel = new JPanel();
                  panel.setLayout(new BorderLayout());
                  final JTabbedPane pane = new JTabbedPane();
                  pane.addTab("Basic controls", basicTab = new CochleaAMS1bBasicPanel(CochleaAMS1b.this));      //creates a new basic (user friendly) panel
                  pane.addTab("Expert controls", expertTab = new CochleaAMS1bControlPanel(CochleaAMS1b.this));  //creates a new expert panel with all biases
                  panel.add(pane, BorderLayout.CENTER);
                  pane.setSelectedIndex(getPrefs().getInt("CochleaAMS1b.selectedBiasgenControlTab", 0));
                  pane.addMouseListener(new java.awt.event.MouseAdapter() {

                  @Override
                  public void mouseClicked(java.awt.event.MouseEvent evt) {
                       getPrefs().putInt("CochleaAMS1b.selectedBiasgenControlTab", pane.getSelectedIndex());
                  }
                  });

                  return panel;

//	CochleaAMS1bControlPanel myControlPanel = new CochleaAMS1bControlPanel(CochleaAMS1b.this);
//	return myControlPanel;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:CochleaAMS1b.java

示例5: buildControlPanel

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
/** @return a new panel for controlling this bias generator functionally
 */
@Override
public JPanel buildControlPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    final JTabbedPane pane = new JTabbedPane();

    pane.addTab("Basic controls", basicTab = new DVSFunctionalControlPanel(DVS128andCochleaAMS1b.this));
    pane.addTab("Expert controls", expertTab = super.buildControlPanel());
    panel.add(pane, BorderLayout.CENTER);
    pane.setSelectedIndex(getPrefs().getInt("DVS128.selectedBiasgenControlTab", 0));
    pane.addMouseListener(new java.awt.event.MouseAdapter() {

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            getPrefs().putInt("DVS128.selectedBiasgenControlTab", pane.getSelectedIndex());
        }
    });

    return panel;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:22,代码来源:DVS128andCochleaAMS1b.java

示例6: buildControlPanel

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
/**
 * @return a new panel for controlling this bias generator functionally
 */
@Override
public JPanel buildControlPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    final JTabbedPane pane = new JTabbedPane();

    pane.addTab("Basic controls", basicTab = new DVSFunctionalControlPanel(DVS128.this));
    pane.addTab("Expert controls", expertTab = super.buildControlPanel());
    panel.add(pane, BorderLayout.CENTER);
    pane.setSelectedIndex(getPrefs().getInt("DVS128.selectedBiasgenControlTab", 0));
    pane.addMouseListener(new java.awt.event.MouseAdapter() {

        @Override
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            getPrefs().putInt("DVS128.selectedBiasgenControlTab", pane.getSelectedIndex());
        }
    });

    return panel;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:24,代码来源:DVS128.java

示例7: onAddNewTDTab

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private MouseAdapter onAddNewTDTab() {
    return new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent me) {
            JTabbedPane tabbedPane = (JTabbedPane) me.getSource();
            if (tabbedPane.getSelectedIndex() != -1 && getSelectedData() == null) {
                Rectangle rect = tabbedPane.getUI().
                        getTabBounds(tabbedPane, tabbedPane.getSelectedIndex());
                if (rect.contains(me.getPoint())) {
                    tabbedPane.setSelectedIndex(tabbedPane.getSelectedIndex() - 1);
                    addNewTestData(tabbedPane);
                }
            }
        }
    };
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:17,代码来源:TestDataComponent.java

示例8: navigateToTestData

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public Boolean navigateToTestData(String sheetName, String columnName) {
    if (envTab.getSelectedComponent() instanceof JTabbedPane) {
        JTabbedPane tab = (JTabbedPane) envTab.getSelectedComponent();
        for (int i = 0; i < tab.getTabCount(); i++) {
            if (tab.getComponentAt(i) instanceof TestDataTablePanel) {
                TestDataTablePanel tdPanel = (TestDataTablePanel) tab.getComponentAt(i);
                if (tdPanel.std.getName().equals(sheetName)) {
                    int colIndex = tdPanel.std.getColumnIndex(columnName);
                    if (colIndex != -1) {
                        tab.setSelectedIndex(i);
                        tdPanel.table.selectColumn(colIndex);
                        return true;
                    }
                    break;
                }
            }
        }
    }
    return false;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:21,代码来源:TestDataComponent.java

示例9: 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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:DiffViewModeSwitcher.java

示例10: testDifferenceCount

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public void testDifferenceCount () throws Exception {
    int dc = simple.getDifferenceCount();
    assertEquals(3, dc);

    // as default, the graphical view is displayed and the diff count is the same as in the old-style diff view
    dc = enhanced.getDifferenceCount();
    assertEquals(3, dc);
    JTabbedPane c = findTabbedPane(enhanced.getJComponent());

    // switching to the textual view
    final boolean[] finished = new boolean[1];
    enhanced.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (DiffController.PROP_DIFFERENCES.equals(evt.getPropertyName())) {
                finished[0] = true;
            }
        }
    });
    c.setSelectedIndex(1);
    dc = enhanced.getDifferenceCount();
    // zero differences for the textual diff view
    // it shows no differences, displays the diff as a whole
    assertEquals(0, dc);
    // and it should fire an event about differences being changed so clients can refresh navigation button etc.
    for (int i = 0; i < 5 && !finished[0]; ++i) {
        Thread.sleep(1000);
    }
    assertTrue(finished[0]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:DefaultDiffControllerProviderTest.java

示例11: PreferencesFrame

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private PreferencesFrame() {
	setDefaultCloseOperation(HIDE_ON_CLOSE);
	setJMenuBar(new LogisimMenuBar(this, null));

	panels = new OptionsPanel[] { new TemplateOptions(this), new IntlOptions(this), new WindowOptions(this),
			new LayoutOptions(this), new ExperimentalOptions(this), new ForkOptions(this), };
	tabbedPane = new JTabbedPane();
	int intlIndex = -1;
	for (int index = 0; index < panels.length; index++) {
		OptionsPanel panel = panels[index];
		tabbedPane.addTab(panel.getTitle(), null, panel, panel.getToolTipText());
		if (panel instanceof IntlOptions)
			intlIndex = index;
	}

	JPanel buttonPanel = new JPanel();
	buttonPanel.add(close);
	close.addActionListener(myListener);

	Container contents = getContentPane();
	tabbedPane.setPreferredSize(new Dimension(450, 300));
	contents.add(tabbedPane, BorderLayout.CENTER);
	contents.add(buttonPanel, BorderLayout.SOUTH);

	if (intlIndex >= 0)
		tabbedPane.setSelectedIndex(intlIndex);

	LocaleManager.addLocaleListener(myListener);
	myListener.localeChanged();
	pack();
	setLocationRelativeTo(null);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:33,代码来源:PreferencesFrame.java

示例12: openTab

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void openTab(Component component, JTabbedPane pane) {
    for (int i = 0; i < pane.getTabCount(); i++) {
        if (component == pane.getComponentAt(i)) {
            pane.setSelectedIndex(i);
            break;
        }
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:9,代码来源:Control.java

示例13: actionPerformed

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void actionPerformed(ActionEvent e) {
    JTabbedPane pane = observer.getTabs();
    int i = pane.indexOfTabComponent(tab);
    JNotepadPPDocument editor = observer.getEditors().get(i);

    List<JNotepadPPDocument> editors = observer.getEditors();

    if (pane.getComponentCount() == 4) {
        return;
    }
    if (editor.isChanged()) {
        int answer = JOptionPane.showConfirmDialog(observer,
                lp.getString("saveMessage"), lp.getString("saveDialog"),
                JOptionPane.YES_NO_CANCEL_OPTION);

        if (answer == JOptionPane.YES_OPTION) {
            editor.saveDocument(false);
        } else if (answer == JOptionPane.CANCEL_OPTION) {
            return;
        }
    }

    pane.remove(i);
    editors.remove(i);
    int size = editors.size();

    if (i >= size) {
        observer.setActiveEditor(editors.get(size - 1));
        pane.setSelectedIndex(size - 1);
    } else {
        observer.setActiveEditor(editors.get(i));
        pane.setSelectedIndex(i);
    }
    observer.getActiveEditor().updateStatusBar();
}
 
开发者ID:fgulan,项目名称:java-course,代码行数:40,代码来源:TabButtonAction.java

示例14: searchTestData

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void searchTestData(Object source) {
    JTabbedPane tab = (JTabbedPane) source;
    List<String> tabs = new ArrayList<>();
    for (int i = 0; i < tab.getTabCount() - 1; i++) {
        tabs.add(tab.getTitleAt(i));
    }
    JComboBox combo = new JComboBox(tabs.toArray());
    int option = JOptionPane.showConfirmDialog(null, combo,
            "Go To TestData",
            JOptionPane.DEFAULT_OPTION);
    if (option == JOptionPane.OK_OPTION) {
        tab.setSelectedIndex(tabs.indexOf(combo.getSelectedItem().toString()));
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:15,代码来源:TestDataComponent.java

示例15: closeTestData

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void closeTestData(Object source) {
    JTabbedPane tab = (JTabbedPane) source;
    TestDataTablePanel panel = getSelectedData();
    if (!panel.isGlobalData) {
        int index = tab.getSelectedIndex();
        tab.setSelectedIndex(index - 1);
        tab.removeTabAt(index);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:10,代码来源:TestDataComponent.java


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