public class DocumentTabPane extends JPanel
JTabbedPane
with larger tabs, ability to close tabs, singleton tabs that are hidden instead of being closedModifier and Type | Class and Description |
---|---|
static class |
DocumentTabPane.CloseMode
Behavior of the tab close button
|
static class |
DocumentTabPane.DocumentTab
Encapsulates a tab
|
static class |
DocumentTabPane.DocumentTabComponent |
static class |
DocumentTabPane.SingletonTab
Encapsulates a singleton tab
|
static class |
DocumentTabPane.SingletonTabMode |
static class |
DocumentTabPane.TabRenamedEvent |
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
DocumentTabPane() |
DocumentTabPane(boolean scrollable)
Creates a new instance
|
Modifier and Type | Method and Description |
---|---|
DocumentTabPane.DocumentTab |
addTab(String title,
Icon icon,
Component component,
DocumentTabPane.CloseMode closeMode)
Adds a new tab
|
DocumentTabPane.DocumentTab |
addTab(String title,
Icon icon,
Component component,
DocumentTabPane.CloseMode closeMode,
boolean allowRename)
Adds a new tab
|
void |
closeAllTabs(boolean force)
Closes all tabs
|
void |
closeAllTabsExcept(DocumentTabPane.DocumentTab exception,
boolean force)
Closes all tabs except the provided one.
|
void |
closeTab(DocumentTabPane.DocumentTab tab)
Closes the tab.
|
void |
closeTab(DocumentTabPane.DocumentTab tab,
boolean force)
Closes a tab.
|
JFrame |
detachTab(JComponent parent,
DocumentTabPane.DocumentTab tab,
boolean reattachAfterClose)
Detaches a tab
|
String |
findTabNameFor(Component component)
Finds the tab title for the content
|
void |
forceCloseTab(DocumentTabPane.DocumentTab tab)
Closes the tab.
|
Component |
getCurrentContent() |
String |
getCurrentlySelectedSingletonTabId()
Returns the currently selected singleton tab ID.
|
BiMap<String,DocumentTabPane.DocumentTab> |
getSingletonTabInstances() |
BiMap<String,DocumentTabPane.SingletonTab> |
getSingletonTabs() |
JTabbedPane |
getTabbedPane() |
DocumentTabPane.DocumentTab |
getTabContainingContent(Component content)
Returns the tab that contains the specified content
|
DocumentTabPane.DocumentTab |
getTabContainingTabComponent(Component content)
Returns the tab that contains the specified tab component
|
int |
getTabCount() |
Border |
getTabPanelBorder() |
Set<DocumentTabPane.DocumentTab> |
getTabs() |
List<DocumentTabPane.DocumentTab> |
getTabsContaining(Class<? extends Component> klass)
Returns all tabs that contain components of provided type or components that inherit from it
|
boolean |
isEnableTabContextMenu() |
boolean |
isScrollable() |
DocumentTabPane.SingletonTab |
registerSingletonTab(String id,
String title,
Icon icon,
Supplier<Component> componentSupplier,
DocumentTabPane.CloseMode closeMode,
DocumentTabPane.SingletonTabMode singletonTabMode)
Adds a tab that can be silently closed and brought up again
|
DocumentTabPane.SingletonTab |
registerSingletonTab(String id,
String title,
Icon icon,
Supplier<Component> componentSupplier,
DocumentTabPane.SingletonTabMode singletonTabMode)
Adds a tab that can be silently closed and brought up again
|
DocumentTabPane.DocumentTab |
selectSingletonTab(String id)
Re-opens or selects a singleton tab
|
void |
setEnableTabContextMenu(boolean enableTabContextMenu) |
void |
setScrollable(boolean scrollable) |
void |
setTabPanelBorder(Border tabPanelBorder) |
void |
switchToContent(Component content)
Switches to the provided content
|
void |
switchToLastTab()
Switches the the last tab.
|
void |
switchToTab(DocumentTabPane.DocumentTab tab)
Switches to the provided tab
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public DocumentTabPane()
public DocumentTabPane(boolean scrollable)
public boolean isScrollable()
public void setScrollable(boolean scrollable)
public BiMap<String,DocumentTabPane.SingletonTab> getSingletonTabs()
public BiMap<String,DocumentTabPane.DocumentTab> getSingletonTabInstances()
public DocumentTabPane.DocumentTab getTabContainingContent(Component content)
content
- the contentpublic DocumentTabPane.DocumentTab getTabContainingTabComponent(Component content)
content
- the contentpublic Set<DocumentTabPane.DocumentTab> getTabs()
public List<DocumentTabPane.DocumentTab> getTabsContaining(Class<? extends Component> klass)
klass
- component type.public Border getTabPanelBorder()
public void setTabPanelBorder(Border tabPanelBorder)
public DocumentTabPane.DocumentTab addTab(String title, Icon icon, Component component, DocumentTabPane.CloseMode closeMode, boolean allowRename)
title
- The tab titleicon
- The tab iconcomponent
- The tab contentcloseMode
- Behavior of the close buttonallowRename
- if true, users can rename the tabpublic void closeAllTabsExcept(DocumentTabPane.DocumentTab exception, boolean force)
exception
- the tab that should be excludedforce
- if non-closable tabs are affectedpublic JFrame detachTab(JComponent parent, DocumentTabPane.DocumentTab tab, boolean reattachAfterClose)
tab
- the tabreattachAfterClose
- if the window is closed, re-attach the tab (always true for non-closable tabs)public void closeTab(DocumentTabPane.DocumentTab tab, boolean force)
tab
- the tab.force
- if non-closable tabs are affectedpublic void closeTab(DocumentTabPane.DocumentTab tab)
tab
- the tabpublic void forceCloseTab(DocumentTabPane.DocumentTab tab)
tab
- the tabpublic DocumentTabPane.DocumentTab addTab(String title, Icon icon, Component component, DocumentTabPane.CloseMode closeMode)
title
- the tab iconicon
- the tab iconcomponent
- the tab contentcloseMode
- Behavior of the close buttonpublic JTabbedPane getTabbedPane()
public int getTabCount()
public void switchToLastTab()
public DocumentTabPane.SingletonTab registerSingletonTab(String id, String title, Icon icon, Supplier<Component> componentSupplier, DocumentTabPane.SingletonTabMode singletonTabMode)
id
- Unique tab identifiertitle
- Tab titleicon
- Tab iconcomponentSupplier
- Tab contentsingletonTabMode
- If the tab is hidden by defaultpublic String getCurrentlySelectedSingletonTabId()
public DocumentTabPane.SingletonTab registerSingletonTab(String id, String title, Icon icon, Supplier<Component> componentSupplier, DocumentTabPane.CloseMode closeMode, DocumentTabPane.SingletonTabMode singletonTabMode)
id
- Unique tab identifiertitle
- Tab titleicon
- Tab iconcomponentSupplier
- Tab contentsingletonTabMode
- How the singleton tab is displayedpublic DocumentTabPane.DocumentTab selectSingletonTab(String id)
id
- the singleton tab IDpublic String findTabNameFor(Component component)
component
- the tab contentpublic void switchToTab(DocumentTabPane.DocumentTab tab)
tab
- the tabpublic void switchToContent(Component content)
content
- the tab contentpublic Component getCurrentContent()
public void closeAllTabs(boolean force)
force
- if non-closable tabs will be closedpublic boolean isEnableTabContextMenu()
public void setEnableTabContextMenu(boolean enableTabContextMenu)
Copyright © 2020–2022 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.