|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
com.mindbright.gui.TabPanel
public class TabPanel
TabPanel is a container for a set of tabbed cards, lying atop each other, but with the labelled tabs exposed at the top. That is, the classic Tab Folder. Each card is an awt.component of whatever design you wish. The topmost card can be selected programmatically (Using first(), last(), next(), previous(), or show(name)), or by clicking on the tab with the mouse.
Components should be added using add(name,component)); the name is used to label the tab. If you set the layout manager, it should be a subclass of CardLayout. You probably want to setBackground() to a color contrasting that of the parent and the components.
Whenever a card is selected (whether by software or mouse), an event with id = Event.WINDOW_EXPOSE is sent to the selected component. Handling this event may be useful for deferred initialization.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
int |
margin
The width of the margins around the cards. |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
TabPanel()
Creates an empty TabPanel. |
Method Summary | |
---|---|
java.awt.Component |
add(java.lang.String name,
java.awt.Component component)
Add a card, component, to the TabPanel with a given name. |
java.lang.String |
documentCard(java.lang.String name)
Return a mouse documentation string for selecting this card. |
void |
doLayout()
Computes tab geometry while laying out the panels components. |
void |
first()
Select the first card in the Panel. |
java.awt.Insets |
getInsets()
Allocates extra margins to give the cards some `body'. |
void |
last()
Select the last card in the Panel. |
void |
next()
Select the next card in the Panel. |
void |
paint(java.awt.Graphics gg)
Paint the tabs in a row atop the cards. |
void |
previous()
Select the previous card in the Panel. |
void |
processMouseEvent(java.awt.event.MouseEvent e)
Handle mouse clicks and documentation line for Tab selection. |
void |
processMouseMotionEvent(java.awt.event.MouseEvent e)
|
void |
remove(java.awt.Component component)
remove the card, component, from the TabPanel. |
void |
remove(java.lang.String name)
remove the card having the given name from the TabPanel. |
void |
removeAll()
remove all cards from the TabPanel. |
void |
setTabFont(java.awt.Font font)
Specify the Font to be used for labeling the Tabs. |
void |
show(java.awt.Component component)
Select the card component in the Panel. |
void |
show(java.lang.String name)
Select the named card in the Panel. |
void |
update(java.awt.Graphics g)
Update (repaint) the TabPanel. |
Methods inherited from class java.awt.Panel |
---|
addNotify, getAccessibleContext |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, 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, getBackground, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, 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, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int margin
Constructor Detail |
---|
public TabPanel()
Method Detail |
---|
public java.awt.Component add(java.lang.String name, java.awt.Component component)
add
in class java.awt.Container
public void remove(java.awt.Component component)
remove
in class java.awt.Container
public void remove(java.lang.String name)
public void removeAll()
removeAll
in class java.awt.Container
public void first()
public void last()
public void next()
public void previous()
public void show(java.lang.String name)
public void show(java.awt.Component component)
public java.lang.String documentCard(java.lang.String name)
public void processMouseEvent(java.awt.event.MouseEvent e)
processMouseEvent
in class java.awt.Component
public void processMouseMotionEvent(java.awt.event.MouseEvent e)
processMouseMotionEvent
in class java.awt.Component
public java.awt.Insets getInsets()
getInsets
in class java.awt.Container
public void setTabFont(java.awt.Font font)
public void doLayout()
doLayout
in class java.awt.Container
public void update(java.awt.Graphics g)
update
in class java.awt.Container
public void paint(java.awt.Graphics gg)
paint
in class java.awt.Container
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |