Package org.compiere.plaf
Class CompiereTabbedPaneUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.TabbedPaneUI
-
- javax.swing.plaf.basic.BasicTabbedPaneUI
-
- javax.swing.plaf.metal.MetalTabbedPaneUI
-
- org.compiere.plaf.CompiereTabbedPaneUI
-
- All Implemented Interfaces:
SwingConstants
public class CompiereTabbedPaneUI extends MetalTabbedPaneUI
Same implementation detail as in AdempierePanelUI. Additional handling of dwawing tabs.- Version:
- $Id: AdempiereTabbedPaneUI.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
CompierePanelUI
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CompiereTabbedPaneUI.TabbedPaneLayout
Layout Manager to overwrite TabRect size-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabSelectionHandler
-
-
Field Summary
-
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
Constructors Constructor Description CompiereTabbedPaneUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
Calculate TabHeightprotected int
calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
Calculate Tab Width.protected LayoutManager
createLayoutManager()
Create Layout Manager to size & position tabsstatic ComponentUI
createUI(JComponent c)
Static Create UIprotected void
installDefaults()
Install Defaultsprotected void
layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)
Layout Labelvoid
paint(Graphics g, JComponent c)
Paint itprotected void
paintContentBorder(Graphics g, int tabPlacement, int selectedIndex)
Paint Content Border (overwriting BasicTabbedPanelUI) Uses Color from actual Tab (not from TabbedPane)protected void
paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
Paint bottom content area edgeprotected void
paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
Paint left content border edgeprotected void
paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
Paint right Contenr border edgeprotected void
paintLeftTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
Paint Border of Left Tab.protected void
paintRightTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
Paint Border of Right Tab.protected void
paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
Paint the actual Tab Background.protected void
paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected)
Paint Tabprotected void
paintTopTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
Paint Top Tab Borderprotected boolean
shouldFillGap(int currentRun, int tabIndex, int x, int y)
Fill Tab gap triangle (no)void
update(Graphics g, JComponent c)
Update - This method is invoked byJComponent
when the specified component is being painted.-
Methods inherited from class javax.swing.plaf.metal.MetalTabbedPaneUI
calculateMaxTabHeight, getBaselineOffset, getColorForGap, getTabLabelShiftX, getTabLabelShiftY, getTabRunOverlay, paintBottomTabBorder, paintContentBorderTopEdge, paintFocusIndicator, paintHighlightBelowTab, paintTabBorder, shouldPadTabRun, shouldRotateTabRuns
-
Methods inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
assureRectsCreated, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, createChangeListener, createFocusListener, createMouseListener, createPropertyChangeListener, createScrollButton, expandTabRunsArray, getBaseline, getBaseline, getBaselineResizeBehavior, getContentBorderInsets, getFocusIndex, getFontMetrics, getIconForTab, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabBounds, getTabInsets, getTabRunCount, getTabRunIndent, getTabRunOffset, getTextViewForTab, getVisibleComponent, installComponents, installKeyboardActions, installListeners, installUI, lastTabInRun, navigateSelectedTab, paintIcon, paintTab, paintTabArea, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setRolloverTab, setVisibleComponent, shouldRotateTabRuns, tabForCoordinate, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize
-
-
-
-
Method Detail
-
createUI
public static ComponentUI createUI(JComponent c)
Static Create UI- Parameters:
c
- Component- Returns:
- Adempiere TabbedPaneUI
-
installDefaults
protected void installDefaults()
Install Defaults- Overrides:
installDefaults
in classMetalTabbedPaneUI
-
update
public void update(Graphics g, JComponent c)
Update - This method is invoked byJComponent
when the specified component is being painted. By default this method will fill the specified component with its background color (if itsopaque
property istrue
) and then immediately callpaint
.- Overrides:
update
in classMetalTabbedPaneUI
- Parameters:
g
- theGraphics
context in which to paintc
- the component being painted- See Also:
paint(java.awt.Graphics, javax.swing.JComponent)
,JComponent.paintComponent(java.awt.Graphics)
-
paint
public void paint(Graphics g, JComponent c)
Paint it- Overrides:
paint
in classMetalTabbedPaneUI
- Parameters:
g
- graphicsc
- component
-
paintTabBackground
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
Paint the actual Tab Background. Called from Basic.PaintTab (<- Basic.paintTabArea <- Basic.paint)Based on MetalTabbedPaneUI.paintTabBackground: Differences: - Color based on primary Background of Tab - Selected Tab is painted
selected not sel top ////////// ////////// (lighter) ++++++++++ (flat/darker) bottom ////////// (flat/lighter) ++++++++++ ++++++++++ (darker) sides ////////// (flat/ligher) ++++++++++ (flat/darker)
- Overrides:
paintTabBackground
in classMetalTabbedPaneUI
- Parameters:
g
- graphicstabPlacement
- tab placementtabIndex
- tab indexx
- xy
- yw
- widthh
- heightisSelected
- selected
-
paintContentBorder
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex)
Paint Content Border (overwriting BasicTabbedPanelUI) Uses Color from actual Tab (not from TabbedPane)- Overrides:
paintContentBorder
in classBasicTabbedPaneUI
- Parameters:
g
- graphicstabPlacement
- tab placementselectedIndex
- index
-
paintContentBorderLeftEdge
protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
Paint left content border edge- Overrides:
paintContentBorderLeftEdge
in classMetalTabbedPaneUI
- Parameters:
g
- graphicstabPlacement
- tab placementselectedIndex
- indexx
- xy
- yw
- widthh
- height
-
paintContentBorderBottomEdge
protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
Paint bottom content area edge- Overrides:
paintContentBorderBottomEdge
in classMetalTabbedPaneUI
- Parameters:
g
- graphicstabPlacement
- tab placementselectedIndex
- indexx
- xy
- yw
- widthh
- height
-
paintContentBorderRightEdge
protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
Paint right Contenr border edge- Overrides:
paintContentBorderRightEdge
in classMetalTabbedPaneUI
- Parameters:
g
- graphicstabPlacement
- tab placementselectedIndex
- indexx
- xy
- yw
- widthh
- height
-
shouldFillGap
protected boolean shouldFillGap(int currentRun, int tabIndex, int x, int y)
Fill Tab gap triangle (no)- Overrides:
shouldFillGap
in classMetalTabbedPaneUI
- Parameters:
currentRun
- current runtabIndex
- tab indexx
- xy
- y- Returns:
- false
-
paintTopTabBorder
protected void paintTopTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
Paint Top Tab Border- Overrides:
paintTopTabBorder
in classMetalTabbedPaneUI
- Parameters:
tabIndex
- indexg
- graphicsx
- xy
- yw
- widthh
- heightbtm
- bottomrght
- rightisSelected
- selected
-
paintLeftTabBorder
protected void paintLeftTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
Paint Border of Left Tab. Does not fill triangle- Overrides:
paintLeftTabBorder
in classMetalTabbedPaneUI
- Parameters:
tabIndex
- indexg
- graphicsx
- xy
- yw
- widthh
- heightbtm
- bottomrght
- rightisSelected
- selected
-
paintRightTabBorder
protected void paintRightTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
Paint Border of Right Tab. Does not fill triangle- Overrides:
paintRightTabBorder
in classMetalTabbedPaneUI
- Parameters:
tabIndex
- indexg
- graphicsx
- xy
- yw
- widthh
- heightbtm
- bottomrght
- rightisSelected
- selected
-
calculateTabWidth
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
Calculate Tab Width. We may have to overwrite to adjust width for TabHirarchyLevel- Overrides:
calculateTabWidth
in classBasicTabbedPaneUI
- Parameters:
tabPlacement
- tab placementtabIndex
- tab indexmetrics
- metcics- Returns:
- tab width
-
calculateTabHeight
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
Calculate TabHeight- Overrides:
calculateTabHeight
in classBasicTabbedPaneUI
- Parameters:
tabPlacement
- tab placementtabIndex
- tab indexfontHeight
- font height- Returns:
- tab height
-
layoutLabel
protected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)
Layout Label- Overrides:
layoutLabel
in classBasicTabbedPaneUI
- Parameters:
tabPlacement
- tab placementmetrics
- fint metricstabIndex
- tab indextitle
- titleicon
- icontabRect
- tab boundsiconRect
- icon boundstextRect
- text boundsisSelected
- selected
-
paintText
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected)
Paint Tab- Overrides:
paintText
in classBasicTabbedPaneUI
- Parameters:
g
- graphicstabPlacement
- tab placementfont
- fontmetrics
- font metricstabIndex
- tab indextitle
- titletextRect
- text boundsisSelected
- selected
-
createLayoutManager
protected LayoutManager createLayoutManager()
Create Layout Manager to size & position tabs- Overrides:
createLayoutManager
in classMetalTabbedPaneUI
- Returns:
- Layout Manager
-
-