Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jgoodies.plaf.plastic
Class PlasticTabbedPaneUI

    java.lang.Object
      javax.swing.plaf.ComponentUI
          javax.swing.plaf.TabbedPaneUI
              javax.swing.plaf.basic.BasicTabbedPaneUI
                  javax.swing.plaf.metal.MetalTabbedPaneUI
                      com.jgoodies.plaf.plastic.PlasticTabbedPaneUI

All Implemented Interfaces:
  SwingConstants

public final class PlasticTabbedPaneUI
extends MetalTabbedPaneUI

The JGoodies Plastic Look&Feel implementation of `TabbedPaneUI`. It differs from its superclass `MetalTabbedPaneUI` in that it paints new tab shapes, provides two options, and supports ClearLook.

You can enable or disable icons in tabs globally via com.jgoodies.plaf.Options.setTabIconsEnabled(boolean).

To disable the content border set

     JTabbedPane tabbedPane = new JTabbedPane();
     tabbedPane.putClientProperty(Option.NO_CONTENT_BORDER_KEY, Boolean.TRUE);

To paint embedded tabs use

     JTabbedPane tabbedPane = new JTabbedPane();
     tabbedPane.putClientProperty(Option.EMBEDDED_TABS_KEY, Boolean.TRUE);

There's a special mode that helps you detect content borders in heavily wrapped component hierarchies - such as the NetBeans IDE. In this marked mode the content border is painted as a Magenta line. You can enable this mode by setting the System property `markContentBorders` to `true`; in a command line:

     java -DmarkContentBorders=true

Author:
  Karsten Lentzsch, Torge Husfeldt
See Also:
  `Options`

Nested Class Summary
`class` | `PlasticTabbedPaneUI.TabSelectionHandler` This inner class is marked "public" due to a compiler bug.

Nested classes inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
`BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler`

Field Summary
`static String` | `MARK_CONTENT_BORDERS_KEY` A System property key for enabling the `JTabbedPane` content border mark mode.

Fields inherited from class javax.swing.plaf.metal.MetalTabbedPaneUI
`minTabWidth, selectColor, selectHighlight, tabAreaBackground`

Fields inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
`calcRect, contentBorderInsets, darkShadow, downKey, focus, focusListener, highlight, leftKey, lightHighlight, maxTabHeight, maxTabWidth, mouseListener, propertyChangeListener, rects, rightKey, runCount, selectedRun, selectedTabPadInsets, shadow, tabAreaInsets, tabChangeListener, tabInsets, tabPane, tabRunOverlay, tabRuns, textIconGap, upKey`

Fields inherited from interface javax.swing.SwingConstants
`BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST`

Constructor Summary
`PlasticTabbedPaneUI()`

Method Summary
`protected ChangeListener` | `createChangeListener()`
`protected LayoutManager` | `createLayoutManager()` Creates the layout manager used to set the tab's bounds.
`protected PropertyChangeListener` | `createPropertyChangeListener()` Creates and answer a handler that listens to property changes.
`static ComponentUI` | `createUI(JComponent tabPane)` Creates the `PlasticTabbedPaneUI`.
`protected Insets` | `getContentBorderInsets(int tabPlacement)` Returns the insets (i.e. the width) of the content Border
`protected Icon` | `getIconForTab(int tabIndex)` Answers the icon for the tab with the specified index.
`protected Insets` | `getSelectedTabPadInsets(int tabPlacement)` Returns the insets for selected tab.
`protected Insets` | `getTabAreaInsets(int tabPlacement)` Returns the amount by which the Tab Area is inset
`protected Insets` | `getTabInsets(int tabPlacement, int tabIndex)` Returns the insets for this tab.
`protected int` | `getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)` Returns the amount by which the label should be shifted horizontally
`protected int` | `getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)` Returns the amount by which the label should be shifted vertically
`protected int` | `getTabRunIndent(int tabPlacement, int run)` Returns the amount by which the run number `run` should be indented.
`protected int` | `getTabRunOverlay(int tabPlacement)` Returns the amount (in pixels) by which two runs should overlap
`void` | `installUI(JComponent c)` Installs the UI.
`protected boolean` | `isTabInFirstRun(int tabIndex)`
`protected void` | `layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)`
`void` | `paint(Graphics g, JComponent c)` Paints the tabbed pane; checks if we replace borders, first.
`protected void` | `paintContentBorder(Graphics g, int tabPlacement, int selectedIndex)`
`protected void` | `paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rectangles, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)` Draws the rectancle around the Tab label which indicates keyboard focus
`protected void` | `paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)` Fills the background of the given tab to make sure overlap of tabs is handled correctly.
`protected void` | `paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)` Paints the border for one tab.
`protected boolean` | `shouldPadTabRun(int tabPlacement, int run)` This boolean controls wheather the given run should be padded to use up as much space as the others (with more tabs in them)
`protected boolean` | `shouldRotateTabRuns(int tabPlacement)` Answers wheather tab runs should be rotated.
`void` | `uninstallUI(JComponent c)` Uninstalls the UI.

Methods inherited from class javax.swing.plaf.metal.MetalTabbedPaneUI
`calculateMaxTabHeight, getColorForGap, installDefaults, paintBottomTabBorder, paintContentBorderBottomEdge, paintContentBorderLeftEdge, paintContentBorderRightEdge, paintContentBorderTopEdge, paintHighlightBelowTab, paintLeftTabBorder, paintRightTabBorder, paintTopTabBorder, shouldFillGap, shouldRotateTabRuns, update`

Methods inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
`assureRectsCreated, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, calculateTabHeight, calculateTabWidth, createFocusListener, createMouseListener, expandTabRunsArray, getFontMetrics, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreferredSize, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRunForTab, getTabBounds, getTabBounds, getTabRunCount, getTabRunOffset, getTextViewForTab, getVisibleComponent, installComponents, installKeyboardActions, installListeners, lastTabInRun, navigateSelectedTab, paintIcon, paintTab, paintTabArea, paintText, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setVisibleComponent, tabForCoordinate, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners`

Methods inherited from class javax.swing.plaf.ComponentUI
`contains, getAccessibleChild, getAccessibleChildrenCount`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MARK_CONTENT_BORDERS_KEY

    public static final String MARK_CONTENT_BORDERS_KEY

  A System property key for enabling the `JTabbedPane` content border mark mode. A l&f may honor this setting to mark content borders, for example by painting in a special color.

  See Also:
    `PlasticTabbedPaneUI`, Constant Field Values

Constructor Detail

### PlasticTabbedPaneUI

    public PlasticTabbedPaneUI()

Method Detail

### createUI

    public static ComponentUI createUI(JComponent tabPane)

  Creates the `PlasticTabbedPaneUI`.

  See Also:
    `ComponentUI.createUI(JComponent)`

### installUI

    public void installUI(JComponent c)

  Installs the UI.

  See Also:
    `ComponentUI.installUI(JComponent)`

### uninstallUI

    public void uninstallUI(JComponent c)

  Uninstalls the UI.

  See Also:
    `ComponentUI.uninstallUI(JComponent)`

### createPropertyChangeListener

    protected PropertyChangeListener createPropertyChangeListener()

  Creates and answer a handler that listens to property changes. Unlike the superclass BasicTabbedPane, the PlasticTabbedPaneUI uses an extended Handler.

### createChangeListener

    protected ChangeListener createChangeListener()

### paint

    public void paint(Graphics g,
                      JComponent c)

  Paints the tabbed pane; checks if we replace borders, first.

### layoutLabel

    protected void layoutLabel(int tabPlacement,
                               FontMetrics metrics,
                               int tabIndex,
                               String title,
                               Icon icon,
                               Rectangle tabRect,
                               Rectangle iconRect,
                               Rectangle textRect,
                               boolean isSelected)

### getIconForTab

    protected Icon getIconForTab(int tabIndex)

  Answers the icon for the tab with the specified index. In case, we have globally switched of the use tab icons, we answer `null` if and only if we have a title.

### createLayoutManager

    protected LayoutManager createLayoutManager()

  Creates the layout manager used to set the tab's bounds.

### isTabInFirstRun

    protected boolean isTabInFirstRun(int tabIndex)

### paintContentBorder

    protected void paintContentBorder(Graphics g,
                                      int tabPlacement,
                                      int selectedIndex)

### getContentBorderInsets

    protected Insets getContentBorderInsets(int tabPlacement)

  Returns the insets (i.e. the width) of the content Border

### getTabAreaInsets

    protected Insets getTabAreaInsets(int tabPlacement)

  Returns the amount by which the Tab Area is inset

### getTabLabelShiftX

    protected int getTabLabelShiftX(int tabPlacement,
                                    int tabIndex,
                                    boolean isSelected)

  Returns the amount by which the label should be shifted horizontally

### getTabLabelShiftY

    protected int getTabLabelShiftY(int tabPlacement,
                                    int tabIndex,
                                    boolean isSelected)

  Returns the amount by which the label should be shifted vertically

### getTabRunOverlay

    protected int getTabRunOverlay(int tabPlacement)

  Returns the amount (in pixels) by which two runs should overlap

### shouldPadTabRun

    protected boolean shouldPadTabRun(int tabPlacement,
                                      int run)

  This boolean controls wheather the given run should be padded to use up as much space as the others (with more tabs in them)

### getTabRunIndent

    protected int getTabRunIndent(int tabPlacement,
                                  int run)

  Returns the amount by which the run number `run` should be indented. Add six pixels for every run to make diagonal lines align.

### getTabInsets

    protected Insets getTabInsets(int tabPlacement,
                                  int tabIndex)

  Returns the insets for this tab.

### getSelectedTabPadInsets

    protected Insets getSelectedTabPadInsets(int tabPlacement)

  Returns the insets for selected tab.

### paintFocusIndicator

    protected void paintFocusIndicator(Graphics g,
                                       int tabPlacement,
                                       Rectangle[] rectangles,
                                       int tabIndex,
                                       Rectangle iconRect,
                                       Rectangle textRect,
                                       boolean isSelected)

  Draws the rectancle around the Tab label which indicates keyboard focus

### paintTabBackground

    protected void paintTabBackground(Graphics g,
                                      int tabPlacement,
                                      int tabIndex,
                                      int x,
                                      int y,
                                      int w,
                                      int h,
                                      boolean isSelected)

  Fills the background of the given tab to make sure overlap of tabs is handled correctly. Note: that tab backgrounds seem to be painted somewhere else, too.

### paintTabBorder

    protected void paintTabBorder(Graphics g,
                                  int tabPlacement,
                                  int tabIndex,
                                  int x,
                                  int y,
                                  int w,
                                  int h,
                                  boolean isSelected)

  Paints the border for one tab. Gets the bounds of the tab as parameters. Note that the result is not clipped so you can paint outside that rectangle. Tabs painted later on have a chance to overwrite though.

### shouldRotateTabRuns

    protected boolean shouldRotateTabRuns(int tabPlacement)

  Answers wheather tab runs should be rotated. If true, the layout mechanism will move the run containing the selected tab so that it touches the content pane.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2004 JGoodies Karsten Lentzsch. All Rights Reserved.