Example usage for javax.swing JTabbedPane WRAP_TAB_LAYOUT

List of usage examples for javax.swing JTabbedPane WRAP_TAB_LAYOUT

Introduction

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

Prototype

int WRAP_TAB_LAYOUT

To view the source code for javax.swing JTabbedPane WRAP_TAB_LAYOUT.

Click Source Link

Document

The tab layout policy for wrapping tabs in multiple runs when all tabs will not fit within a single run.

Usage

From source file:Main.java

TabView() {
    tabbedPane.addTab("Hello", new JLabel("World"));
    tabbedPane.addTab("Goodbye", new JLabel("Sunshine"));
    setLayout(new BorderLayout());

    tabbedPane.setTabPlacement(JTabbedPane.TOP);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);
    add(tabbedPane, BorderLayout.CENTER);
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    textField1.requestFocusInWindow();//from   w w  w . ja  v a  2s .  co m
    tab1.add(textField1);

    tab2.add(textField2);
    tab2.add(textField3);

    contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());

    tabbedPane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    tabbedPane.addTab("TAB 1", null, tab1, "I am TAB 1");
    tabbedPane.addTab("TAB 2", null, tab2, "I am TAB 2");

    focusButton = new JButton("CHANGE FOCUS");
    getRootPane().setDefaultButton(focusButton);
    focusButton.addActionListener(this);

    contentPane.add(tabbedPane, BorderLayout.CENTER);
    contentPane.add(focusButton, BorderLayout.PAGE_END);
    setContentPane(contentPane);
    pack();
    setVisible(true);
}

From source file:Main.java

public Main(String title) {
    super(title);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar menuBar = new JMenuBar();
    tabComponentsItem = new JCheckBoxMenuItem("Use TabComponents", true);
    tabComponentsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.ALT_MASK));
    tabComponentsItem.addActionListener(e -> {
        for (int i = 0; i < pane.getTabCount(); i++) {
            if (tabComponentsItem.isSelected()) {
            } else {
                pane.setTabComponentAt(i, null);
            }//from ww  w  .  j a v a  2  s.  c  o m
        }
    });
    scrollLayoutItem = new JCheckBoxMenuItem("Set ScrollLayout");
    scrollLayoutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK));
    scrollLayoutItem.addActionListener(e -> {
        if (pane.getTabLayoutPolicy() == JTabbedPane.WRAP_TAB_LAYOUT) {
            pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        } else {
            pane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);
        }
    });
    JMenuItem resetItem = new JMenuItem("Reset JTabbedPane");
    resetItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_MASK));
    resetItem.addActionListener(e -> runTest());
    JMenu optionsMenu = new JMenu("Options");
    optionsMenu.add(tabComponentsItem);
    optionsMenu.add(scrollLayoutItem);
    optionsMenu.add(resetItem);
    menuBar.add(optionsMenu);
    setJMenuBar(menuBar);
    add(pane);
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmSwing.CFCrmSwingServiceEltJTabbedPane.java

public CFCrmSwingServiceEltJTabbedPane(ICFCrmSwingSchema argSchema, ICFCrmServiceObj argFocus) {
    super(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }//from  w ww .ja v a  2s .c  o m
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    setSwingFocusAsService(argFocus);
    // Wire the newly constructed JPanels/Tabs to this JTabbedPane
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingMemoTagEltJTabbedPane.java

public CFCrmSwingMemoTagEltJTabbedPane(ICFCrmSwingSchema argSchema, ICFCrmMemoTagObj argFocus) {
    super(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }//w w  w  . j a  v a2s.  c o m
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    setSwingFocusAsMemoTag(argFocus);
    // Wire the newly constructed JPanels/Tabs to this JTabbedPane
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingSecFormEltJTabbedPane.java

public CFCrmSwingSecFormEltJTabbedPane(ICFCrmSwingSchema argSchema, ICFCrmSecFormObj argFocus) {
    super(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }/*  w  ww.  j av a 2s .  co m*/
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    setSwingFocusAsSecForm(argFocus);
    // Wire the newly constructed JPanels/Tabs to this JTabbedPane
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingVersionEltJTabbedPane.java

public CFCrmSwingVersionEltJTabbedPane(ICFCrmSwingSchema argSchema, ICFCrmVersionObj argFocus) {
    super(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }//  w  w  w  . j  a  v a 2 s  .  c o m
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    setSwingFocusAsVersion(argFocus);
    // Wire the newly constructed JPanels/Tabs to this JTabbedPane
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingMimeTypeEltJTabbedPane.java

public CFCrmSwingMimeTypeEltJTabbedPane(ICFCrmSwingSchema argSchema, ICFCrmMimeTypeObj argFocus) {
    super(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }/* w w w  .  j av a  2  s.  c o m*/
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    setSwingFocusAsMimeType(argFocus);
    // Wire the newly constructed JPanels/Tabs to this JTabbedPane
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingPhoneTagEltJTabbedPane.java

public CFCrmSwingPhoneTagEltJTabbedPane(ICFCrmSwingSchema argSchema, ICFCrmPhoneTagObj argFocus) {
    super(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }// w w w .ja v  a  2  s .  c  o m
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    setSwingFocusAsPhoneTag(argFocus);
    // Wire the newly constructed JPanels/Tabs to this JTabbedPane
    swingIsInitializing = false;
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingAddressTagEltJTabbedPane.java

public CFCrmSwingAddressTagEltJTabbedPane(ICFCrmSwingSchema argSchema, ICFCrmAddressTagObj argFocus) {
    super(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }/* w  ww.  j  a  va  2  s. com*/
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    setSwingFocusAsAddressTag(argFocus);
    // Wire the newly constructed JPanels/Tabs to this JTabbedPane
    swingIsInitializing = false;
}