Class CloseTabPaneUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.TabbedPaneUI
-
- javax.swing.plaf.basic.BasicTabbedPaneUI
-
- com.openindex.openestate.tool.utils.tabs.CloseTabPaneUI
-
- All Implemented Interfaces:
SwingConstants
- Direct Known Subclasses:
CloseTabPaneEclipseUI,CloseTabPaneEnhancedUI
public class CloseTabPaneUI extends BasicTabbedPaneUI
UI forCloseAndMaxTabbedPane.- Author:
- Amy Fowler, Philip Milne, Steve Wilson, Tom Santos, Dave Moore, David Bismut, davidou@mageos.com, Andreas Rudolph
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classCloseTabPaneUI.MyMouseMotionListenerprotected classCloseTabPaneUI.ScrollableTabButtonprotected classCloseTabPaneUI.ScrollableTabPanelprotected classCloseTabPaneUI.ScrollableTabSupportprotected static classCloseTabPaneUI.ScrollableTabViewportclassCloseTabPaneUI.TabSelectionHandlerThis inner class is marked "public" due to a compiler bug.-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabbedPaneLayout
-
-
Field Summary
Fields Modifier and Type Field Description protected JPopupMenuactionPopupMenuprotected static intBUTTONSIZEprotected JMenuItemcloseItemprotected JMenuItemmaxItemprotected CloseTabPaneUI.MyMouseMotionListenermotionListenerprotected CloseTabPaneUI.ScrollableTabSupporttabScrollerprotected static intWIDTHDELTA-
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 CloseTabPaneUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intcalculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)protected intcalculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)protected ChangeListenercreateChangeListener()protected LayoutManagercreateLayoutManager()Invoked byinstallUIto create a layout manager object to manage theJTabbedPane.protected MouseListenercreateMouseListener()protected CloseTabPaneUI.ScrollableTabButtoncreateScrollableTabButton(int direction)static ComponentUIcreateUI(JComponent c)protected InsetsgetContentBorderInsets(int tabPlacement)intgetOverTabIndex()protected StringgetShortTitle(String title)protected RectanglegetTabBounds(int tabIndex, Rectangle dest)Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component.protected voidinstallComponents()Creates and installs any required subcomponents for the JTabbedPane.protected voidinstallKeyboardActions()protected voidinstallListeners()booleanisCloseEnabled()booleanisMaxEnabled()protected booleanisOneActionButtonEnabled()protected voidlayoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)protected RectanglenewCloseRect(Rectangle rect)protected RectanglenewMaxRect(Rectangle rect)voidpaint(Graphics g, JComponent c)protected voidpaintActionButton(Graphics g, int dx, int dy, int status, boolean isOver, JButton button, BufferedImage image)protected voidpaintCloseIcon(Graphics g, int dx, int dy, boolean isOver)protected voidpaintMaxIcon(Graphics g, int dx, int dy, boolean isOver)protected voidpaintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)voidscroll(int tab)voidsetCloseIcon(boolean b)voidsetCloseIconImage(BufferedImage img)voidsetMaxIcon(boolean b)voidsetMaxIconImage(BufferedImage img)protected voiduninstallComponents()Removes any installed subcomponents from the JTabbedPane.protected voiduninstallKeyboardActions()protected voiduninstallListeners()protected voidupdateCloseIcon(int x, int y)protected voidupdateMaxIcon(int x, int y)protected voidupdateOverTab(int x, int y)-
Methods inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
assureRectsCreated, calculateMaxTabHeight, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, createFocusListener, createPropertyChangeListener, createScrollButton, expandTabRunsArray, getBaseline, getBaseline, getBaselineOffset, getBaselineResizeBehavior, getFocusIndex, getFontMetrics, getIconForTab, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabInsets, getTabLabelShiftX, getTabLabelShiftY, getTabRunCount, getTabRunIndent, getTabRunOffset, getTabRunOverlay, getTextViewForTab, getVisibleComponent, installDefaults, installUI, lastTabInRun, navigateSelectedTab, paintContentBorder, paintContentBorderBottomEdge, paintContentBorderLeftEdge, paintContentBorderRightEdge, paintContentBorderTopEdge, paintFocusIndicator, paintIcon, paintTabArea, paintTabBackground, paintTabBorder, paintText, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setRolloverTab, setVisibleComponent, shouldPadTabRun, shouldRotateTabRuns, tabForCoordinate, uninstallDefaults, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize, update
-
-
-
-
Field Detail
-
tabScroller
protected CloseTabPaneUI.ScrollableTabSupport tabScroller
-
motionListener
protected CloseTabPaneUI.MyMouseMotionListener motionListener
-
BUTTONSIZE
protected static final int BUTTONSIZE
- See Also:
- Constant Field Values
-
WIDTHDELTA
protected static final int WIDTHDELTA
- See Also:
- Constant Field Values
-
actionPopupMenu
protected JPopupMenu actionPopupMenu
-
maxItem
protected JMenuItem maxItem
-
closeItem
protected JMenuItem closeItem
-
-
Method Detail
-
getContentBorderInsets
protected Insets getContentBorderInsets(int tabPlacement)
- Overrides:
getContentBorderInsetsin classBasicTabbedPaneUI
-
isOneActionButtonEnabled
protected boolean isOneActionButtonEnabled()
-
isCloseEnabled
public boolean isCloseEnabled()
-
isMaxEnabled
public boolean isMaxEnabled()
-
scroll
public void scroll(int tab)
-
setCloseIcon
public void setCloseIcon(boolean b)
-
setCloseIconImage
public void setCloseIconImage(BufferedImage img)
-
setMaxIcon
public void setMaxIcon(boolean b)
-
setMaxIconImage
public void setMaxIconImage(BufferedImage img)
-
calculateTabWidth
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)- Overrides:
calculateTabWidthin classBasicTabbedPaneUI
-
calculateTabHeight
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)- Overrides:
calculateTabHeightin classBasicTabbedPaneUI
-
layoutLabel
protected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)- Overrides:
layoutLabelin classBasicTabbedPaneUI
-
createMouseListener
protected MouseListener createMouseListener()
- Overrides:
createMouseListenerin classBasicTabbedPaneUI
-
createScrollableTabButton
protected CloseTabPaneUI.ScrollableTabButton createScrollableTabButton(int direction)
-
updateOverTab
protected void updateOverTab(int x, int y)
-
updateCloseIcon
protected void updateCloseIcon(int x, int y)
-
updateMaxIcon
protected void updateMaxIcon(int x, int y)
-
createUI
public static ComponentUI createUI(JComponent c)
-
createLayoutManager
protected LayoutManager createLayoutManager()
Invoked byinstallUIto create a layout manager object to manage theJTabbedPane.- Overrides:
createLayoutManagerin classBasicTabbedPaneUI- Returns:
- a layout manager object
- See Also:
BasicTabbedPaneUI.TabbedPaneLayout,JTabbedPane.getTabLayoutPolicy()
-
installComponents
protected void installComponents()
Creates and installs any required subcomponents for the JTabbedPane. Invoked by installUI.- Overrides:
installComponentsin classBasicTabbedPaneUI- Since:
- 1.4
-
uninstallComponents
protected void uninstallComponents()
Removes any installed subcomponents from the JTabbedPane. Invoked by uninstallUI.- Overrides:
uninstallComponentsin classBasicTabbedPaneUI- Since:
- 1.4
-
installListeners
protected void installListeners()
- Overrides:
installListenersin classBasicTabbedPaneUI
-
uninstallListeners
protected void uninstallListeners()
- Overrides:
uninstallListenersin classBasicTabbedPaneUI
-
createChangeListener
protected ChangeListener createChangeListener()
- Overrides:
createChangeListenerin classBasicTabbedPaneUI
-
installKeyboardActions
protected void installKeyboardActions()
- Overrides:
installKeyboardActionsin classBasicTabbedPaneUI
-
uninstallKeyboardActions
protected void uninstallKeyboardActions()
- Overrides:
uninstallKeyboardActionsin classBasicTabbedPaneUI
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paintin classBasicTabbedPaneUI
-
paintTab
protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)
- Overrides:
paintTabin classBasicTabbedPaneUI
-
paintCloseIcon
protected void paintCloseIcon(Graphics g, int dx, int dy, boolean isOver)
-
paintMaxIcon
protected void paintMaxIcon(Graphics g, int dx, int dy, boolean isOver)
-
paintActionButton
protected void paintActionButton(Graphics g, int dx, int dy, int status, boolean isOver, JButton button, BufferedImage image)
-
getTabBounds
protected Rectangle getTabBounds(int tabIndex, Rectangle dest)
Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component. This is required because the tab rects are by default defined in the coordinate space of the component where they are rendered, which could be the JTabbedPane (for WRAP_TAB_LAYOUT) or a ScrollableTabPanel (SCROLL_TAB_LAYOUT). This method should be used whenever the tab rectangle must be relative to the JTabbedPane itself and the result should be placed in a designated Rectangle object (rather than instantiating and returning a new Rectangle each time). The tab index parameter must be a valid tabbed pane tab index (0 to tab count - 1, inclusive). The destination rectangle parameter must be a validRectangleinstance. The handling of invalid parameters is unspecified.- Overrides:
getTabBoundsin classBasicTabbedPaneUI- Parameters:
tabIndex- the index of the tabdest- the rectangle where the result should be placed- Returns:
- the resulting rectangle
- Since:
- 1.4
-
getOverTabIndex
public int getOverTabIndex()
-
-