Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mindbright.gui
Class TabPanel

    java.lang.Object
      java.awt.Component
          java.awt.Container
              java.awt.Panel
                  com.mindbright.gui.TabPanel

All Implemented Interfaces:
  javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class TabPanel
extends java.awt.Panel

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.

Author:
  Bruce R. Miller (bruce.miller@nist.gov), Contribution of the National Institute of Standards and Technology,, not subject to copyright.
See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class java.awt.Panel
`java.awt.Panel.AccessibleAWTPanel`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes 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, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, 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, 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, isOpaque, 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, setName, 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

### margin

    public int margin

  The width of the margins around the cards.

Constructor Detail

### TabPanel

    public TabPanel()

  Creates an empty TabPanel.

Method Detail

### add

    public java.awt.Component add(java.lang.String name,
                                  java.awt.Component component)

  Add a card, component, to the TabPanel with a given name.

### remove

    public void remove(java.awt.Component component)

  remove the card, component, from the TabPanel.

### remove

    public void remove(java.lang.String name)

  remove the card having the given name from the TabPanel.

### removeAll

    public void removeAll()

  remove all cards from the TabPanel.

### first

    public void first()

  Select the first card in the Panel.

### last

    public void last()

  Select the last card in the Panel.

### next

    public void next()

  Select the next card in the Panel.

### previous

    public void previous()

  Select the previous card in the Panel.

### show

    public void show(java.lang.String name)

  Select the named card in the Panel.

### show

    public void show(java.awt.Component component)

  Select the card component in the Panel.

### documentCard

    public java.lang.String documentCard(java.lang.String name)

  Return a mouse documentation string for selecting this card. (ie. the applet status line (if there is an applet), for when the mouse is over the tab). This may be overridden by a subclass, if desired. The default is to use the "Select tab card " + name.

### processMouseEvent

    public void processMouseEvent(java.awt.event.MouseEvent e)

  Handle mouse clicks and documentation line for Tab selection.

### processMouseMotionEvent

    public void processMouseMotionEvent(java.awt.event.MouseEvent e)

### getInsets

    public java.awt.Insets getInsets()

  Allocates extra margins to give the cards some `body'.

### setTabFont

    public void setTabFont(java.awt.Font font)

  Specify the Font to be used for labeling the Tabs. This avoids getting in the way of cards inheriting default fonts from the TabPanel's container.

### doLayout

    public void doLayout()

  Computes tab geometry while laying out the panels components.

### update

    public void update(java.awt.Graphics g)

  Update (repaint) the TabPanel. Since paint handles the background, we just call paint directly.

### paint

    public void paint(java.awt.Graphics gg)

  Paint the tabs in a row atop the cards.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD