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


Java JTabbedPane.setTabLayoutPolicy方法代码示例

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


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

示例1: TabbedPanel

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public TabbedPanel() {
	setLayout(new BorderLayout());
	pane = new JTabbedPane(JTabbedPane.TOP);
	pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
	pane.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseReleased(MouseEvent e) {
			// Only close tabs when middle-clicked
			if (e.getButton() != MouseEvent.BUTTON2) {
				return;
			}
			int index = pane.getSelectedIndex();
			if (index >= 0) {
				String key = childToTitle.remove(pane.getSelectedComponent());
				titleToChild.remove(key);
				pane.remove(index);
			}
		}
	});
	add(pane, BorderLayout.CENTER);
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:22,代码来源:TabbedPanel.java

示例2: 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

示例3: 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;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:22,代码来源:TestDataComponent.java

示例4: initWorkspace

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void initWorkspace() {
	workspacePane = new JTabbedPane(JTabbedPane.TOP);
	workspacePane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);
	centerPane.setRightComponent(workspacePane);
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:6,代码来源:MainFrame.java

示例5: TabbedPaneDemo

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public TabbedPaneDemo() {
    super(new GridLayout(1, 1));

    JTabbedPane tabbedPane = new JTabbedPane();
    ImageIcon icon = createImageIcon("images/middle.gif");

    JComponent panel1 = makeTextPanel("Panel #1");
    tabbedPane.addTab("Tab 1", icon, panel1, "Does nothing");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    JComponent panel2 = makeTextPanel("Panel #2");
    tabbedPane.addTab("Tab 2", icon, panel2, "Does twice as much nothing");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    JComponent panel3 = makeTextPanel("Panel #2");
    tabbedPane.addTab("Tab 3", icon, panel3, "Still does nothing");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    JComponent panel4 = makeTextPanel("Panel #4 (has a preferred size of 410 x 50).");
    panel4.setPreferredSize(new Dimension(410, 50));
    tabbedPane.addTab("Tab 4", icon, panel4, "Does nothing at all");
    tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

    // Add the tabbed pane to this panel.
    add(tabbedPane);

    // The following line enables to use scrolling tabs.
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:30,代码来源:TabbedPaneDemo.java

示例6: GUIPane

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
/**
 * 
 */
public GUIPane() {
	// super(new GridLayout(1, 2));
	super(new GridBagLayout());

	GridBagConstraints c = new GridBagConstraints();
	simulation = false;
	actPane = new ActionPane();

	// JScrollPane scroller = new JScrollPane(actPane);
	// this.add(actPane, c);
	// this.add(scroller, BorderLayout.WEST);

	tabbedPane = new JTabbedPane();
	// c.fill = GridBagConstraints.HORIZONTAL;
	c.fill = GridBagConstraints.BOTH;
	c.weightx = 0.5;
	c.weighty = 0.5;
	c.gridx = 1;
	c.gridy = 0;
	c.gridwidth = 1;

	// Add the tabbed pane to this panel.
	this.add(tabbedPane, c);

	// The following line enables to use scrolling tabs.
	tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
	tabbedPane.addChangeListener(this);

	this.setSize(this.getWidth(), tabbedPane.getHeight());

}
 
开发者ID:tslaats,项目名称:SE2017-Team2,代码行数:35,代码来源:GUIPane.java

示例7: createAndShowUI

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private static void createAndShowUI() {
    frame = new JFrame("bug7170310");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 100);

    tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Main Tab", new JPanel());

    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    frame.getContentPane().add(tabbedPane);
    frame.setVisible(true);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:bug7170310.java

示例8: bug6416920

import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public bug6416920() {
    super();

    // Set parameters for the padSelectedTab() method
    selectedTabPadInsets = new Insets(0, 0, 0, 0);

    tabPane = new JTabbedPane();
    tabPane.setSize(100, 0);
    tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    rects = new Rectangle[1];
    rects[0] = new Rectangle(150, 0, 0, 0);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:bug6416920.java


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