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


Java JTabbedPane类代码示例

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


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

示例1: main

import javax.swing.JTabbedPane; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

        Robot robot = new Robot();
        SwingUtilities.invokeAndWait(() -> {
            frame = new JFrame();
            frame.setSize(500, 500);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

            tabbedPane = new JTabbedPane();

            for (int i = 0; i < TAB_COUNT; i++) {
                tabbedPane.add("Header " + i, new JLabel("Content: " + i));
            }

            frame.getContentPane().setLayout(new BorderLayout());
            frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
            frame.setVisible(true);
        });

        robot.waitForIdle();

        SwingUtilities.invokeAndWait(() -> {
            for (int j = 0; j < ITERATIONS; j++) {
                for (int i = 0; i < TAB_COUNT; i++) {
                    tabbedPane.setTitleAt(i, getHtmlText(j * TAB_COUNT + i));
                }
            }
        });
        robot.waitForIdle();

        SwingUtilities.invokeAndWait(() -> frame.dispose());
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:bug8017284.java

示例2: closeAllButCurrent

import javax.swing.JTabbedPane; //导入依赖的package包/类
void closeAllButCurrent() {
    Component comp = getComponent(0);
    if (comp instanceof JTabbedPane) {
        JTabbedPane tabs = (JTabbedPane) comp;
        Component current = tabs.getSelectedComponent();
        int tabCount = tabs.getTabCount();
        // #172039: do not use tabs.getComponents()
        Component[] c = new Component[tabCount - 1];
        for (int i = 0, j = 0; i < tabCount; i++) {
            Component tab = tabs.getComponentAt(i);
            if (tab != current) {
                c[j++] = tab;
            }
        }
        for (int i = 0; i < c.length; i++) {
            ((RefactoringPanel) c[i]).close();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:RefactoringPanelContainer.java

示例3: componentClosed

import javax.swing.JTabbedPane; //导入依赖的package包/类
@Override
protected void componentClosed() {
    isVisible = false;
    if (getComponentCount() == 0) {
        return ;
    }
    Component comp = getComponent(0);
    if (comp instanceof JTabbedPane) {
        JTabbedPane pane = (JTabbedPane) comp;
        // #172039: do not use tabs.getComponents()
        Component[] c = new Component[pane.getTabCount()];
        for (int i = 0; i < c.length; i++) {
            c[i] = pane.getComponentAt(i);
        }
        for (int i = 0; i < c.length; i++) {
            ((RefactoringPanel) c[i]).close();
        }
    } else if (comp instanceof RefactoringPanel) {
        ((RefactoringPanel) comp).close();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:RefactoringPanelContainer.java

示例4: stateChanged

import javax.swing.JTabbedPane; //导入依赖的package包/类
/**
 * {@link ChangeEvent} of the {@link #tabbedPane} (Menu: Single Player /
 * Duel / Tournament / About)
 */
@Override
public void stateChanged(ChangeEvent e) {
	if (e.getSource() instanceof JTabbedPane) {
		if (tabbedPane.getSelectedIndex() == 4) {
			if (buttonStart != null) {
				buttonStart.setEnabled(false);
			}
			if (runInBackgroundCheckbox != null) {
				runInBackgroundCheckbox.setEnabled(false);
			}
		} else {
			if (buttonStart != null) {
				buttonStart.setEnabled(true);
			}
			if (runInBackgroundCheckbox != null) {
				runInBackgroundCheckbox.setEnabled(true);
			}
		}
	}

}
 
开发者ID:gamefest2017,项目名称:ants,代码行数:26,代码来源:MenuListener.java

示例5: HookPanel

import javax.swing.JTabbedPane; //导入依赖的package包/类
public HookPanel(VCSCommitPanel master, Collection<? extends VCSHook> hooks, VCSHookContext hookContext) {            
    super(master, (hooks.size() == 1)
            ? hooks.iterator().next().getDisplayName()
            : getMessage("LBL_Advanced"), //NOI18N
            DEFAULT_DISPLAY_HOOKS);
    this.hooks = hooks;
    this.hookContext = hookContext;
    
    // need this to happen in addNotify() - depends on how 
    // repositoryComboSupport in hook.createComponents works for bugzilla|jira
    if (hooks.size() == 1) {                
        JPanel p = hooks.iterator().next().createComponent(hookContext);
        if (Boolean.TRUE.equals(p.getClientProperty("prop.requestOpened"))) { //NOI18N - some hook panels may want to be opened (hg queue hook with previously configured setts)
            super.displaySection();
        }
        sectionPanel.add(p);
    } else {
        JTabbedPane hooksTabbedPane = new JTabbedPane();
        for (VCSHook hook : hooks) {
            hooksTabbedPane.add(hook.createComponent(hookContext), hook.getDisplayName().replaceAll("\\&", ""));
        }
        sectionPanel.add(hooksTabbedPane);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:CollapsiblePanel.java

示例6: initSidePane

import javax.swing.JTabbedPane; //导入依赖的package包/类
private void initSidePane() {
	sidePane = new JTabbedPane(JTabbedPane.TOP);
	centerPane.setLeftComponent(sidePane);
	sidePane.setMinimumSize(new Dimension(180, 0));

	projectPanel = new JPanel();
	sidePane.addTab("Project", null, projectPanel, null);
	projectPanel.setLayout(new BorderLayout(0, 0));

	projectScrollPane = new JScrollPane();
	projectPanel.add(projectScrollPane, BorderLayout.CENTER);

	repositoryPanel = new JPanel();
	sidePane.addTab("Repository", null, repositoryPanel, null);
	repositoryPanel.setLayout(new BorderLayout(0, 0));

	repositoryScrollPane = new JScrollPane();
	repositoryPanel.add(repositoryScrollPane, BorderLayout.CENTER);
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:20,代码来源:MainFrame.java

示例7: 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();
        }

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

示例8: initialize

import javax.swing.JTabbedPane; //导入依赖的package包/类
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
	frame = new JFrame();
	frame.setBounds(100, 100, 450, 300);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.getContentPane().setLayout(new GridLayout(1, 0, 0, 0));

	JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
	frame.getContentPane().add(tabbedPane);

	JScrollPane scrollPane = new JScrollPane();
	tabbedPane.addTab("New tab", null, scrollPane, null);

	JScrollPane scrollPane_1 = new JScrollPane();
	tabbedPane.addTab("New tab", null, scrollPane_1, null);
}
 
开发者ID:FlyArts,项目名称:NovelJ,代码行数:19,代码来源:SettingsWindow_Windows.java

示例9: testTextualDiffContent

import javax.swing.JTabbedPane; //导入依赖的package包/类
public void testTextualDiffContent () throws Exception {
    File diffFile = new File(getDataDir(), "enhancedview/diff");
    String goldenText = getFileContents(diffFile);
    goldenText = MessageFormat.format(goldenText, new Object[] {"a/", "b/"});

    final JTabbedPane tabbedPane = findTabbedPane(enhanced.getJComponent());
    JPanel p = (JPanel) tabbedPane.getComponentAt(1);
    tabbedPane.setSelectedIndex(1);
    JEditorPane pane = findEditorPane(p);
    assertFalse(pane == null);
    String text = pane.getText();
    for (int i = 0; i < 100; ++i) {
        if (!text.isEmpty()) {
            break;
        }
        Thread.sleep(100);
        text = pane.getText();
    }
    assertEquals(goldenText, text);
    EventQueue.invokeAndWait(new Runnable() {
        @Override
        public void run () {
            tabbedPane.setSelectedIndex(0);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:DefaultDiffControllerProviderTest.java

示例10: tpTabsStateChanged

import javax.swing.JTabbedPane; //导入依赖的package包/类
private void tpTabsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tpTabsStateChanged
    Component component = ((JTabbedPane) evt.getSource ()).getSelectedComponent ();
    if (component instanceof SettingsTab) {
        int i = ((SettingsTab)component).getSelectedRow();
        ((SettingsTab)component).getSettingsTableModel ().refreshModel ();
        if (i > -1) {
            ((SettingsTab)component).setSelectedRow(i);
        }
        wasSettings = true;
    } else {
        if (wasSettings) {
            final UnitCategoryTableModel availableModel = (UnitCategoryTableModel) (availableTable).getModel ();
            final Map<String, Boolean> availableState = UnitCategoryTableModel.captureState (availableModel.getUnits ());
            ((SettingsTab) tpTabs.getComponentAt (INDEX_OF_SETTINGS_TAB)).doLazyRefresh (new Runnable () { // get SettingsTab
                @Override
                public void run () {
                    UnitCategoryTableModel.restoreState (availableModel.getUnits (), availableState, false);
                }
            });
        }
        wasSettings = false;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:PluginManagerUI.java

示例11: computeOptionsWords

import javax.swing.JTabbedPane; //导入依赖的package包/类
private void computeOptionsWords() {
    Set<Map.Entry<String, CategoryModel.Category>> categories = categoryModel.getCategories();
    categoryid2tabs = new HashMap<String, HashMap<Integer, TabInfo>>();
    for (Map.Entry<String, CategoryModel.Category> set : categories) {
        JComponent jcomp = set.getValue().getComponent();
        String id = set.getValue().getID();
        if(jcomp instanceof JTabbedPane) {
            categoryid2tabbedpane.put(id, (JTabbedPane)jcomp);
        } else if(jcomp instanceof AdvancedPanel) {
            categoryid2tabbedpane.put(id, (JTabbedPane)jcomp.getComponent(0));
        } else if (jcomp instanceof Container) {
            handleAllComponents((Container) jcomp, id, null, -1);
        }
    }

    FileObject keywordsFOs = FileUtil.getConfigRoot().getFileObject(CategoryModel.OD_LAYER_KEYWORDS_FOLDER_NAME);

    for(FileObject keywordsFO : keywordsFOs.getChildren()) {
        handlePanel(keywordsFO);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:OptionsPanel.java

示例12: handleAllComponents

import javax.swing.JTabbedPane; //导入依赖的package包/类
private void handleAllComponents(Container container, String categoryID, JTabbedPane tabbedPane, int index) {
    Component[] components = container.getComponents();
    Component component;
    for (int i = 0; i < components.length; i++) {
        component = components[i];
        String text;
        
        if(component instanceof JTabbedPane) {
            if(categoryid2tabbedpane.get(categoryID) == null) {
                categoryid2tabbedpane.put(categoryID, (JTabbedPane)component);
            }
        } else {
            handleAllComponents((Container)component, categoryID, tabbedPane, index);
        }
    }
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:OptionsPanel.java

示例13: loc

import javax.swing.JTabbedPane; //导入依赖的package包/类
private static void loc(JTabbedPane p, int tabIdx, String key, JEditorPane ep) {
    JLabel label = new JLabel(); // Only for setting tab names

    String tabName = loc("CTL_" + key); //NOI18N
    Mnemonics.setLocalizedText(label, tabName);
    p.setTitleAt(tabIdx, label.getText());

    int idx = Mnemonics.findMnemonicAmpersand(tabName);
    if (idx != -1 && idx + 1 < tabName.length()) {
        char ch = Character.toUpperCase(tabName.charAt(idx + 1));
        p.setMnemonicAt(tabIdx, ch);
        if (ep != null) {
            ep.setFocusAccelerator(ch);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:CodeTemplatesPanel.java

示例14: init

import javax.swing.JTabbedPane; //导入依赖的package包/类
@Override
@SuppressWarnings("nls")
public void init()
{
	setShowScripting(true);

	configTab = new DRMConfigTab();
	rightsTab = new DRMRightsTab();
	accessControlTab = new DRMAccessControlTab(getClientService().getService(RemoteUserService.class));
	requireAcceptanceFromTab = new DRMRequireAcceptanceFromTab();

	JTabbedPane tabs = new JTabbedPane();
	tabs.addTab(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drmpageeditor.config"), configTab);
	tabs.addTab(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drmpageeditor.rights"), rightsTab);
	tabs.addTab(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drmpageeditor.access"), accessControlTab);
	tabs.addTab(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drmpageeditor.requires"),
		requireAcceptanceFromTab);

	addSection(tabs);
}
 
开发者ID:equella,项目名称:Equella,代码行数:21,代码来源:DrmPageEditor.java

示例15: init

import javax.swing.JTabbedPane; //导入依赖的package包/类
/**
 * Initialize this visualizer
 * @throws ClassNotFoundException 
 * @throws IllegalAccessException 
 * @throws InstantiationException 
 */
private void init() {  // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    log.debug("init() - pass");
    setLayout(new BorderLayout(0, 5));
    setBorder(makeBorder());
    add(makeTitlePanel(), BorderLayout.NORTH);

    leftSide = createLeftPanel();
    // Prepare the common tab
    rightSide = new JTabbedPane();

    // Create the split pane
    mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSide, rightSide);
    mainSplit.setOneTouchExpandable(true);

    JSplitPane searchAndMainSP = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 
            new SearchTreePanel(root), mainSplit);
    searchAndMainSP.setOneTouchExpandable(true);
    add(searchAndMainSP, BorderLayout.CENTER);
    // init right side with first render
    resultsRender.setRightSide(rightSide);
    resultsRender.init();
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:29,代码来源:ViewResultsFullVisualizer.java


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