Java Swing UIManager getNestedTabbedPane(int orient, int top, int left, int bottom, int right)

Here you can find the source of getNestedTabbedPane(int orient, int top, int left, int bottom, int right)

Description

Make a JTabbedPane without some of its border

License

Open Source License

Parameter

Parameter Description
orient tab orientation
top top border
left left border
bottom bottom border
right right border

Return

Tabbed pane

Declaration

public static JTabbedPane getNestedTabbedPane(int orient, int top, int left, int bottom, int right) 

Method Source Code

//package com.java2s;
/*/* w w w  .  j a  v  a 2  s . c  o m*/
 * Copyright 1997-2016 Unidata Program Center/University Corporation for
 * Atmospheric Research, P.O. Box 3000, Boulder, CO 80307,
 * support@unidata.ucar.edu.
 * 
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at
 * your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

import java.awt.Insets;

import javax.swing.JTabbedPane;

import javax.swing.UIManager;

public class Main {
    /**
     * Make a JTabbedPane without some of its border
     *
     * @return Tabbed pane
     */
    public static JTabbedPane getNestedTabbedPane() {
        return getNestedTabbedPane(JTabbedPane.TOP);
    }

    /**
     * Make a JTabbedPane without some of its border
     *
     * @param orient tab orientation
     *
     * @return Tabbed pane
     */
    public static JTabbedPane getNestedTabbedPane(int orient) {
        if (orient == JTabbedPane.TOP) {
            return getNestedTabbedPane(orient, 1, 0, 0, 0);
        }
        if (orient == JTabbedPane.BOTTOM) {
            return getNestedTabbedPane(orient, 0, 0, 1, 0);
        }
        if (orient == JTabbedPane.LEFT) {
            return getNestedTabbedPane(orient, 1, 1, 0, 0);
        }
        return getNestedTabbedPane(orient, 1, 0, 0, 1);
    }

    /**
     * Make a JTabbedPane without some of its border
     *
     * @param orient tab orientation
     * @param top top border
     * @param left left border
     * @param bottom bottom border
     * @param right right  border
     *
     * @return Tabbed pane
     */
    public static JTabbedPane getNestedTabbedPane(int orient, int top, int left, int bottom, int right) {
        Insets oldInsets = UIManager.getInsets("TabbedPane.contentBorderInsets");
        Insets insets = new Insets(top, left, bottom, right);
        UIManager.put("TabbedPane.contentBorderInsets", insets);
        JTabbedPane tabPane = new JTabbedPane(orient);
        UIManager.put("TabbedPane.contentBorderInsets", oldInsets);
        return tabPane;
    }
}

Related

  1. getIconForeground()
  2. getListBackground(final boolean selected)
  3. getListForeground()
  4. getListForeground(final boolean selected)
  5. getMinimumPropPanelHeight()
  6. getNimbusClassName()
  7. getPropertyMaxGutterIconWidth(final String propertyPrefix)
  8. getRowHeight(java.awt.Component c)
  9. getSeparator()