本文整理汇总了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);
}
示例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();
}
});
}
示例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;
}
示例4: initWorkspace
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void initWorkspace() {
workspacePane = new JTabbedPane(JTabbedPane.TOP);
workspacePane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);
centerPane.setRightComponent(workspacePane);
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}