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 class
CloseTabPaneUI.MyMouseMotionListener
protected class
CloseTabPaneUI.ScrollableTabButton
protected class
CloseTabPaneUI.ScrollableTabPanel
protected class
CloseTabPaneUI.ScrollableTabSupport
protected static class
CloseTabPaneUI.ScrollableTabViewport
class
CloseTabPaneUI.TabSelectionHandler
This 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 JPopupMenu
actionPopupMenu
protected static int
BUTTONSIZE
protected JMenuItem
closeItem
protected JMenuItem
maxItem
protected CloseTabPaneUI.MyMouseMotionListener
motionListener
protected CloseTabPaneUI.ScrollableTabSupport
tabScroller
protected static int
WIDTHDELTA
-
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 int
calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
protected int
calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
protected ChangeListener
createChangeListener()
protected LayoutManager
createLayoutManager()
Invoked byinstallUI
to create a layout manager object to manage theJTabbedPane
.protected MouseListener
createMouseListener()
protected CloseTabPaneUI.ScrollableTabButton
createScrollableTabButton(int direction)
static ComponentUI
createUI(JComponent c)
protected Insets
getContentBorderInsets(int tabPlacement)
int
getOverTabIndex()
protected String
getShortTitle(String title)
protected Rectangle
getTabBounds(int tabIndex, Rectangle dest)
Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component.protected void
installComponents()
Creates and installs any required subcomponents for the JTabbedPane.protected void
installKeyboardActions()
protected void
installListeners()
boolean
isCloseEnabled()
boolean
isMaxEnabled()
protected boolean
isOneActionButtonEnabled()
protected void
layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)
protected Rectangle
newCloseRect(Rectangle rect)
protected Rectangle
newMaxRect(Rectangle rect)
void
paint(Graphics g, JComponent c)
protected void
paintActionButton(Graphics g, int dx, int dy, int status, boolean isOver, JButton button, BufferedImage image)
protected void
paintCloseIcon(Graphics g, int dx, int dy, boolean isOver)
protected void
paintMaxIcon(Graphics g, int dx, int dy, boolean isOver)
protected void
paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)
void
scroll(int tab)
void
setCloseIcon(boolean b)
void
setCloseIconImage(BufferedImage img)
void
setMaxIcon(boolean b)
void
setMaxIconImage(BufferedImage img)
protected void
uninstallComponents()
Removes any installed subcomponents from the JTabbedPane.protected void
uninstallKeyboardActions()
protected void
uninstallListeners()
protected void
updateCloseIcon(int x, int y)
protected void
updateMaxIcon(int x, int y)
protected void
updateOverTab(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:
getContentBorderInsets
in 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:
calculateTabWidth
in classBasicTabbedPaneUI
-
calculateTabHeight
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
- Overrides:
calculateTabHeight
in classBasicTabbedPaneUI
-
layoutLabel
protected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)
- Overrides:
layoutLabel
in classBasicTabbedPaneUI
-
createMouseListener
protected MouseListener createMouseListener()
- Overrides:
createMouseListener
in 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 byinstallUI
to create a layout manager object to manage theJTabbedPane
.- Overrides:
createLayoutManager
in 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:
installComponents
in classBasicTabbedPaneUI
- Since:
- 1.4
-
uninstallComponents
protected void uninstallComponents()
Removes any installed subcomponents from the JTabbedPane. Invoked by uninstallUI.- Overrides:
uninstallComponents
in classBasicTabbedPaneUI
- Since:
- 1.4
-
installListeners
protected void installListeners()
- Overrides:
installListeners
in classBasicTabbedPaneUI
-
uninstallListeners
protected void uninstallListeners()
- Overrides:
uninstallListeners
in classBasicTabbedPaneUI
-
createChangeListener
protected ChangeListener createChangeListener()
- Overrides:
createChangeListener
in classBasicTabbedPaneUI
-
installKeyboardActions
protected void installKeyboardActions()
- Overrides:
installKeyboardActions
in classBasicTabbedPaneUI
-
uninstallKeyboardActions
protected void uninstallKeyboardActions()
- Overrides:
uninstallKeyboardActions
in classBasicTabbedPaneUI
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paint
in classBasicTabbedPaneUI
-
paintTab
protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)
- Overrides:
paintTab
in 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 validRectangle
instance. The handling of invalid parameters is unspecified.- Overrides:
getTabBounds
in 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()
-
-