public class TabbedPanel extends Container
AWT component to provide a tabbed pane similar to Swings JTabbedPane (albeit somewhat simpler!).
Each component added except the first will be invisible until the user clicks on the tab heading either above, below. to the left, or to the right of the visible component. Clicking on the heading will hide the current tab and make the new selection visible.
Container.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
BOTTOM
Tabs are placed below the components
|
static int |
LEFT
Tabs are placed to the left of the components
|
static int |
RIGHT
Tabs are placed to the right of the components
|
static int |
TOP
Tabs are placed above the components
|
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
TabbedPanel(int position)
Create a tabbed panel with the tabs at the specified position.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Component comp,
Object constraints,
Image image) |
void |
add(Component comp,
Object constraints,
int index,
Image image)
Add a tab.
|
void |
addActionListener(ActionListener l)
Add an
ActionListener to be informed when the user selects a
tab. |
protected void |
addImpl(Component comp,
Object constraints,
int index) |
void |
addNotify() |
Insets |
getInsets() |
int |
getPosition() |
int |
getSelectedTab()
Get the index of the currently selected tab
|
int |
getSelectedTabIndex() |
static void |
main(String[] args) |
void |
paint(Graphics g) |
void |
remove(int idx) |
void |
removeActionListener(ActionListener l)
Remove an
ActionListener so as to no longer be informed when
the user selects a tab. |
void |
removeNotify() |
void |
setPosition(int position)
Create a tabbed panel with the tabs at the specified position.
|
void |
setSelectedTab(int idx)
Set the selected tab given its index.
|
void |
setTitleAt(int i,
String title)
Set the title of a tab at the given index
|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final int TOP
public static final int LEFT
public static final int BOTTOM
public static final int RIGHT
public TabbedPanel(int position)
Create a tabbed panel with the tabs at the specified position. Can be one of :-
Note, only TOP is currently supported
position - positionpublic void addActionListener(ActionListener l)
ActionListener to be informed when the user selects a
tab.l - listener to addpublic void removeActionListener(ActionListener l)
ActionListener so as to no longer be informed when
the user selects a tab.l - listener to removepublic void setTitleAt(int i,
String title)
i - index of tabtitle - new tab titlepublic void setSelectedTab(int idx)
idx - index of tab to selectpublic int getSelectedTab()
public void setPosition(int position)
Create a tabbed panel with the tabs at the specified position. Can be one of :-
Note, only TOP is currently supported
position - positionpublic void add(Component comp, Object constraints, int index, Image image)
comp - componentconstraints - tab nameindex - tab indeximage - tab imagepublic int getPosition()
public void removeNotify()
removeNotify in class Containerpublic static void main(String[] args)
public int getSelectedTabIndex()
Copyright © 2021. All rights reserved.