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:net.sourceforge.msscodefactory.cfsecurity.v2_1.CFSecuritySwing.CFSecuritySwingSecUserEltJTabbedPane.java

public CFSecuritySwingSecUserEltJTabbedPane(ICFSecuritySwingSchema argSchema, ICFSecuritySecUserObj 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  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;
    setSwingFocusAsSecUser(argFocus);
    // Wire the newly constructed JPanels/Tabs to this JTabbedPane
    addTab(LABEL_TabComponentsSecDevList, getTabViewComponentsSecDevListJPanel());
    addTab(LABEL_TabComponentsSecSessList, getTabViewComponentsSecSessListJPanel());
    addTab(LABEL_TabChildrenSecProxyList, getTabViewChildrenSecProxyListJPanel());
    addTab(LABEL_TabChildrenSecGroupMemberList, getTabViewChildrenSecGroupMemberListJPanel());
    addTab(LABEL_TabChildrenTSecGroupMemberList, getTabViewChildrenTSecGroupMemberListJPanel());
    swingIsInitializing = false;
}

From source file:org.openmicroscopy.shoola.agents.fsimporter.view.ImporterUI.java

/** Initializes the components. */
private void initComponents() {
    messageLabel = new JXLabel();
    messageLabel.setText(TEXT_REFRESH);/*ww  w. j a v a  2 s.  c  o m*/
    messageLabel.setVisible(false);
    messageLabel.setFont(messageLabel.getFont().deriveFont(Font.BOLD));
    controlsBar = buildControls();
    controlsBar.setVisible(false);
    uiElementID = 0;
    uiElements = new LinkedHashMap<Integer, ImporterUIElement>();
    tabs = new ClosableTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    tabs.setAlignmentX(LEFT_ALIGNMENT);
    tabs.addPropertyChangeListener(controller);
    tabs.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            controlsBar.setVisible(tabs.getSelectedIndex() != 0);
            controller.getAction(ImporterControl.RETRY_BUTTON).setEnabled(hasFailuresToReupload());
            controller.getAction(ImporterControl.SEND_BUTTON).setEnabled(hasFailuresToSend());
        }
    });
}

From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java

/** Builds and lays out the GUI. */
private void buildGUI() {
    Browser browser = model.getBrowser();
    int sizeX = model.getTiledImageSizeX();
    int sizeY = model.getTiledImageSizeY();

    browser.setComponentsSize(sizeX, sizeY);
    tabs = new ClosableTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    tabs.setAlignmentX(LEFT_ALIGNMENT);//from   w  w w.  j  a v  a 2s . co m

    viewPanel = new ClosableTabbedPaneComponent(ImViewer.VIEW_INDEX, browser.getTitle(), browser.getIcon(), "");
    viewPanel.setClosable(false);
    double[][] tl = { { TableLayout.PREFERRED, TableLayout.FILL },
            { TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED } };
    viewPanel.setLayout(new TableLayout(tl));
    viewPanel.add(controlPane, "0, 0");
    viewPanel.add(browser.getUI(), "1, 0");
    viewPanel.add(controlPane.getTimeSliderPane(ImViewer.VIEW_INDEX), "1, 1");
    if (model.isLifetimeImage()) {
        viewPanel.add(controlPane.getLifetimeSliderPane(ImViewer.VIEW_INDEX), "1, 2");
    }
    tabbedIconHeight = browser.getIcon().getIconHeight() + ICON_EXTRA;

    tabs.insertTab(browser.getTitle(), browser.getIcon(), viewPanel, "", ImViewer.VIEW_INDEX);
    gridViewPanel = new ClosableTabbedPaneComponent(ImViewer.GRID_INDEX, browser.getGridViewTitle(),
            browser.getGridViewIcon(), "");
    gridViewPanel.setLayout(new TableLayout(tl));

    gridViewPanel.add(controlPane.buildGridComponent(), "0, 0");
    gridViewPanel.add(browser.getGridView(), "1, 0");
    gridViewPanel.add(controlPane.getTimeSliderPane(ImViewer.GRID_INDEX), "1, 1");
    if (model.isLifetimeImage()) {
        gridViewPanel.add(controlPane.getLifetimeSliderPane(ImViewer.GRID_INDEX), "1, 2");
    }
    if (model.allowSplitView() && !model.isBigImage()) {
        tabs.insertTab(browser.getGridViewTitle(), browser.getGridViewIcon(), gridViewPanel, "",
                ImViewer.GRID_INDEX);
    }

    double[][] tl2 = { { TableLayout.PREFERRED, TableLayout.FILL },
            { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED } };

    projectionViewPanel = new ClosableTabbedPaneComponent(ImViewer.PROJECTION_INDEX,
            browser.getProjectionViewTitle(), browser.getProjectionViewIcon(), "");

    projectionViewPanel.setLayout(new TableLayout(tl2));
    projectionViewPanel.add(controlPane.buildProjectionToolBar(), "0, 0, 1, 0");
    projectionViewPanel.add(controlPane.buildProjectionComponent(), "0, 1");
    projectionViewPanel.add(browser.getProjectionView(), "1, 1");
    projectionViewPanel.add(controlPane.getTimeSliderPane(ImViewer.PROJECTION_INDEX), "1, 2");
    if (model.getMaxZ() > 0 && !model.isBigImage()) {
        tabs.insertTab(browser.getProjectionViewTitle(), browser.getProjectionViewIcon(), projectionViewPanel,
                "", ImViewer.PROJECTION_INDEX);
    }

    tabs.addChangeListener(controller);

    //mainComponent = tabs;
    rendererSplit.setLeftComponent(tabs);
    mainComponent = rendererSplit;

    Container container = getContentPane();
    container.setLayout(new BorderLayout(0, 0));
    container.add(toolBar, BorderLayout.NORTH);
    container.add(mainComponent, BorderLayout.CENTER);
    container.add(statusBar, BorderLayout.SOUTH);

    //attach listener to the frame border
    boundsAdapter = new HierarchyBoundsAdapter() {

        /**
         * Stores the size of the tab pane when the frame is resized.
         * @see HierarchyBoundsListener#ancestorResized(HierarchyEvent)
         */
        public void ancestorResized(HierarchyEvent e) {
            if (tabs != null)
                restoreSize = tabs.getSize();
        }
    };
    container.addHierarchyBoundsListener(boundsAdapter);
    //restoreSize = new Dimension(0, 0);
    //layoutComponents(false);
}