Example usage for javax.swing JTabbedPane JTabbedPane

List of usage examples for javax.swing JTabbedPane JTabbedPane

Introduction

In this page you can find the example usage for javax.swing JTabbedPane JTabbedPane.

Prototype

public JTabbedPane() 

Source Link

Document

Creates an empty TabbedPane with a default tab placement of JTabbedPane.TOP.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    // Get the index of the first tab that matches a label
    String label = "Tab Label";
    int index = pane.indexOfTab(label);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    int loc = pane.getTabPlacement();

    int location = JTabbedPane.LEFT; // or TOP, BOTTOM, RIGHT
    pane = new JTabbedPane(location);
    pane.setTabPlacement(JTabbedPane.BOTTOM);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    // Get the index of the currently selected tab
    int selIndex = pane.getSelectedIndex();

    // Select the last tab
    selIndex = pane.getTabCount() - 1;/*from w  w w . jav  a  2 s  .  co m*/
    pane.setSelectedIndex(selIndex);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    int rows = pane.getTabRunCount();

    int policy = pane.getTabLayoutPolicy(); // WRAP_TAB_LAYOUT

    pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    ImageIcon icon = null;//from  w w  w  .j  a  v  a  2 s  .c  o m
    int index = pane.indexOfTab(icon);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    JButton component = new JButton("button");

    String label = "Tab Label";
    pane.addTab(label, component);/*from w  ww  .j  ava  2  s . c o m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    JButton component = new JButton("button");

    component.setName("Tab Label");
    pane.add(component);//from w ww .  j a va  2  s .  c o  m

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    JButton component = new JButton("button");
    int index = pane.indexOfComponent(component);

    if (index < 0) {
        // The tab could not be found
    }// w  ww . j a  v a2 s.  c  om
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    String label = "Tab Label";
    String tooltip = "Tool Tip Text";
    pane.addTab(label, null, new JButton("Button"), tooltip);
    int index = pane.getTabCount() - 1;
    tooltip = pane.getToolTipTextAt(index);
    tooltip = "New Tool Tip Text";
    pane.setToolTipTextAt(index, tooltip);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    JButton component = new JButton("button");
    // Remove the last tab
    pane.remove(pane.getTabCount() - 1);

    // Remove the tab with the specified child component
    pane.remove(component);/*from   w w w  . ja  v a 2s . c o m*/

    // Remove all the tabs
    pane.removeAll();
}