public abstract class BasicScrollingTabDisplayerUI extends BasicTabDisplayerUI
Modifier and Type | Class and Description |
---|---|
protected class |
BasicScrollingTabDisplayerUI.ScrollingDisplayerComponentListener |
protected class |
BasicScrollingTabDisplayerUI.ScrollingHierarchyListener |
protected class |
BasicScrollingTabDisplayerUI.ScrollingTabState |
BasicTabDisplayerUI.BasicDisplayerMouseListener, BasicTabDisplayerUI.BasicModelListener, BasicTabDisplayerUI.BasicSelectionListener, BasicTabDisplayerUI.BasicTabState
AbstractTabDisplayerUI.DisplayerHierarchyListener, AbstractTabDisplayerUI.DisplayerPropertyChangeListener, AbstractTabDisplayerUI.ModelListener
defaultRenderer, repaintPolicy, tabState
componentListener, hierarchyListener, layoutModel, modelListener, mouseListener, propertyChangeListener, selectionListener
displayer, selectionModel
Constructor and Description |
---|
BasicScrollingTabDisplayerUI(TabDisplayer displayer)
Creates a new instance of BasicScrollingTabDisplayerUI
|
Modifier and Type | Method and Description |
---|---|
void |
autoscroll(Point location)
Scroll the tabs when something is dragged over the TabDisplayer.
|
protected ComponentListener |
createComponentListener()
Create a ComponentListener that may be needed to handle resize, show,
hide, etc.
|
protected HierarchyListener |
createHierarchyListener() |
protected LayoutManager |
createLayout() |
protected TabLayoutModel |
createLayoutModel()
Create an instance of TabLayoutModel which will provide coordinates for
tabs
|
protected TabState |
createTabState()
Create a TabState instance.
|
Insets |
getAutoscrollInsets() |
protected Component |
getControlButtons() |
protected Rectangle |
getControlButtonsRectangle(Container parent) |
protected int |
getFirstVisibleTab()
Scrollable implementations will override this method to provide the first
visible (even if clipped) tab.
|
protected int |
getLastVisibleTab()
Scrollable implementations will override this method to provide the last
visible (even if clipped) tab.
|
Dimension |
getMinimumSize(JComponent c) |
static Graphics2D |
getOffscreenGraphics()
Provides an offscreen graphics context so that widths based on character
size can be calculated correctly before the component is shown.
|
static Graphics2D |
getOffscreenGraphics(JComponent component)
Provides an offscreen graphics context so that widths based on character
size can be calculated correctly before the component is shown.
|
Insets |
getTabAreaInsets()
Return a set of insets defining the margins into which tabs should not be
painted.
|
protected int |
getTabsAreaWidth()
Returns the width of the tabs area
|
protected void |
install()
Overridden to initialize the
tabState and defaultRenderer . |
protected void |
installControlButtons() |
void |
makeTabVisible(int tab)
Instruct the UI to ensure that the tab at the given index is visible.
|
protected void |
modelChanged()
Overrides
modelChanged() to clear the transient information in the
state model, which may now contain tab indices that don't exist, and also
to clear cached width/last-visible-tab data in the layout model, and ensure that
the selected tab is visible. |
protected void |
processMouseWheelEvent(MouseWheelEvent e)
Overridden to update the offset of the ScrollingTabLayoutModel on mouse
wheel events
|
protected ScrollingTabLayoutModel |
scroll()
Convenience getter for the layout model as an instance of
ScrollingTabLayoutModel
|
protected void |
uninstall()
Called after uninstalling the mouse listener and selection model, but
before references to that or the layout model or displayer have been
nulled.
|
cancelRequestAttention, createDefaultRenderer, createImageOfTab, createModelListener, createMouseListener, createPropertyChangeListener, createRepaintPolicy, createSelectionListener, dropIndexOfPoint, getExactTabIndication, getInsertTabIndication, getLastKnownMouseLocation, getTabCellRenderer, getTabRect, getTabRectForRepaint, getTabsVisibleArea, isAntialiased, paint, paintAfterTabs, paintBackground, requestAttention, setAttentionHighlight, tabForCoordinate
createFont, createSelectionModel, installListeners, installUI, registerShortcuts, toDropPoint, uninstallListeners, uninstallUI, unregisterShortcuts
getButtonIcon, getTxtFont, isTabBusy, postTabAction, shouldPerformAction, shouldPerformAction
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getPreferredSize, update
public BasicScrollingTabDisplayerUI(TabDisplayer displayer)
public Insets getAutoscrollInsets()
getAutoscrollInsets
in class TabDisplayerUI
public void autoscroll(Point location)
TabDisplayerUI
autoscroll
in class TabDisplayerUI
location
- Mouse location in TabDisplayer's coordinates.protected TabLayoutModel createLayoutModel()
AbstractTabDisplayerUI
createLayoutModel
in class AbstractTabDisplayerUI
protected TabState createTabState()
BasicTabDisplayerUI
setMouseInTab(int tab)
. Its getState() method returns a bitmask of
states a tab may have which affect the way it is painted.
Usage: It is expected that UIs will subclass TabState, to implement the
repaint methods, and possibly override getState(int tab)
to mix
additional state bits into the bitmask. For example, scrollable tabs have the
possible states CLIP_LEFT and CLIP_RIGHT; BasicScrollingTabDisplayerUI's
implementation of this determines these states by consulting its layout model, and
adds them in when appropriate.
createTabState
in class BasicTabDisplayerUI
BasicTabDisplayerUI.BasicTabState
,
BasicScrollingTabDisplayerUI.ScrollingTabState
protected HierarchyListener createHierarchyListener()
createHierarchyListener
in class AbstractTabDisplayerUI
public void makeTabVisible(int tab)
TabDisplayerUI
makeTabVisible
in class TabDisplayerUI
tab
- The index of the tab that should be made visible, which
should be within the range of 0 to the count of tabs in the
modelprotected final int getTabsAreaWidth()
public Insets getTabAreaInsets()
BasicTabDisplayerUI
getTabAreaInsets
in class BasicTabDisplayerUI
protected final int getLastVisibleTab()
BasicTabDisplayerUI
getLastVisibleTab
in class BasicTabDisplayerUI
protected final int getFirstVisibleTab()
BasicTabDisplayerUI
getFirstVisibleTab
in class BasicTabDisplayerUI
protected void install()
BasicTabDisplayerUI
tabState
and defaultRenderer
.install
in class BasicTabDisplayerUI
protected void uninstall()
AbstractTabDisplayerUI
uninstall
in class BasicTabDisplayerUI
protected LayoutManager createLayout()
protected Component getControlButtons()
protected ComponentListener createComponentListener()
AbstractTabDisplayerUI
createComponentListener
in class AbstractTabDisplayerUI
protected void modelChanged()
modelChanged()
to clear the transient information in the
state model, which may now contain tab indices that don't exist, and also
to clear cached width/last-visible-tab data in the layout model, and ensure that
the selected tab is visible.modelChanged
in class BasicTabDisplayerUI
protected void installControlButtons()
protected final ScrollingTabLayoutModel scroll()
protected void processMouseWheelEvent(MouseWheelEvent e)
processMouseWheelEvent
in class BasicTabDisplayerUI
public static Graphics2D getOffscreenGraphics()
For more accurate text measurements, clients should prefer calling
BasicScrollingTabDisplayerUI.getOffscreenGraphics(JComponent)
.
public static Graphics2D getOffscreenGraphics(JComponent component)
component
- may be null without causing fatal errors, but should be set for accurate
text measurement (especially on displays with HiDPI scaling enabled)protected Rectangle getControlButtonsRectangle(Container parent)
public Dimension getMinimumSize(JComponent c)
getMinimumSize
in class ComponentUI