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 classCompiereTabbedPaneUI.TabbedPaneLayoutLayout 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 intcalculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)Calculate TabHeightprotected intcalculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)Calculate Tab Width.protected LayoutManagercreateLayoutManager()Create Layout Manager to size & position tabsstatic ComponentUIcreateUI(JComponent c)Static Create UIprotected voidinstallDefaults()Install Defaultsprotected voidlayoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)Layout Labelvoidpaint(Graphics g, JComponent c)Paint itprotected voidpaintContentBorder(Graphics g, int tabPlacement, int selectedIndex)Paint Content Border (overwriting BasicTabbedPanelUI) Uses Color from actual Tab (not from TabbedPane)protected voidpaintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)Paint bottom content area edgeprotected voidpaintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)Paint left content border edgeprotected voidpaintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)Paint right Contenr border edgeprotected voidpaintLeftTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)Paint Border of Left Tab.protected voidpaintRightTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)Paint Border of Right Tab.protected voidpaintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)Paint the actual Tab Background.protected voidpaintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected)Paint Tabprotected voidpaintTopTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)Paint Top Tab Borderprotected booleanshouldFillGap(int currentRun, int tabIndex, int x, int y)Fill Tab gap triangle (no)voidupdate(Graphics g, JComponent c)Update - This method is invoked byJComponentwhen 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:
installDefaultsin classMetalTabbedPaneUI
-
update
public void update(Graphics g, JComponent c)
Update - This method is invoked byJComponentwhen the specified component is being painted. By default this method will fill the specified component with its background color (if itsopaqueproperty istrue) and then immediately callpaint.- Overrides:
updatein classMetalTabbedPaneUI- Parameters:
g- theGraphicscontext 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:
paintin 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:
paintTabBackgroundin 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:
paintContentBorderin 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:
paintContentBorderLeftEdgein 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:
paintContentBorderBottomEdgein 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:
paintContentBorderRightEdgein 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:
shouldFillGapin 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:
paintTopTabBorderin 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:
paintLeftTabBorderin 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:
paintRightTabBorderin 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:
calculateTabWidthin classBasicTabbedPaneUI- Parameters:
tabPlacement- tab placementtabIndex- tab indexmetrics- metcics- Returns:
- tab width
-
calculateTabHeight
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)Calculate TabHeight- Overrides:
calculateTabHeightin 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:
layoutLabelin 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:
paintTextin 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:
createLayoutManagerin classMetalTabbedPaneUI- Returns:
- Layout Manager
-
-