Java Code Examples for javax.swing.JTabbedPane#setTabLayoutPolicy()

The following examples show how to use javax.swing.JTabbedPane#setTabLayoutPolicy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FrontEnd.java    From microrts with GNU General Public License v3.0 6 votes vote down vote up
public FrontEnd() throws Exception {
    super(new GridLayout(1, 1));
     
    JTabbedPane tabbedPane = new JTabbedPane();
     
    FEStatePane panel1 = new FEStatePane();
    tabbedPane.addTab("States", null, panel1, "Load/save states and play games.");
     
    JComponent panel2 = new FETracePane(panel1);
    tabbedPane.addTab("Traces", null, panel2, "Load/save and view replays.");
    
    JComponent panel3 = new FETournamentPane();
    tabbedPane.addTab("Tournaments", null, panel3, "Run tournaments.");

    //Add the tabbed pane to this panel.
    add(tabbedPane);
     
    //The following line enables to use scrolling tabs.
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);   
}
 
Example 2
Source File: TestDataComponent.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: bug6416920.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: bug7170310.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 5
Source File: bug6416920.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: SpacecraftTab.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
public SpacecraftTab(Spacecraft s) {
	sat = s;
	tabbedPane = new JTabbedPane(JTabbedPane.TOP);
	tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
	setLayout(new BorderLayout(0, 0));
	add(tabbedPane, BorderLayout.CENTER);
	addHealthTabs();
	addMeasurementsTab(sat);
}
 
Example 7
Source File: bug7170310.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 8
Source File: PanelController.java    From SproutLife with MIT License 5 votes vote down vote up
public void buildPanels() {
    gameFrame = new GameFrame(this);
    gameMenu = new GameMenu(this);
    gameFrame.setJMenuBar(gameMenu);
    gameToolbar = new GameToolbar(this);
    
    boardRenderer = new BoardRenderer(getGameModel());
    displayControlPanel = new DisplayControlPanel(this);
    settingsControlPanel = new RulesControlPanel(this);
    statsPanel = new StatsPanel(this);
    tipsPanel = new TipsPanel(this);
    ScrollPanel scrollPanel = getScrollPanel();
    

    JTabbedPane rightPane = new JTabbedPane();
    rightPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    rightPane.addTab("Display", wrapInScrolPane(displayControlPanel));
    rightPane.addTab("Rules", wrapInScrolPane(settingsControlPanel));
    rightPane.addTab("Stats", statsPanel);
    rightPane.addTab("Tips", tipsPanel);

    JPanel gamePanel = new JPanel(new BorderLayout());
    gamePanel.add(scrollPanel, BorderLayout.CENTER);
    gamePanel.add(gameToolbar, BorderLayout.NORTH);

    splitPane = new JSplitPane();
    splitPane.setResizeWeight(1);
    splitPane.setOneTouchExpandable(true);
    splitPane.setLeftComponent(gamePanel);
    splitPane.setRightComponent(rightPane);

    gameFrame.add(splitPane);
}
 
Example 9
Source File: bug6416920.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 10
Source File: bug7170310.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 11
Source File: bug7170310.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 12
Source File: bug7170310.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 13
Source File: TabbedPaneDemo.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 14
Source File: bug6416920.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 15
Source File: bug7170310.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 16
Source File: bug6416920.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 17
Source File: bug7170310.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 18
Source File: bug6416920.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 19
Source File: bug6416920.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 20
Source File: bug6416920.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}