netcom.gui
Class TabPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended bynetcom.gui.TabPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable

public class TabPanel
extends java.awt.Panel
implements java.awt.event.MouseListener, java.awt.event.ActionListener

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.

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.

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
 void actionPerformed(java.awt.event.ActionEvent ev)
           
 java.awt.Component add(java.lang.String name, java.awt.Component component)
           
 java.awt.Component add(java.lang.String name, java.lang.String title, java.awt.Component component)
           
 java.lang.String documentCard(java.lang.String name)
          Return a mouse documentation string for selecting this card.
 void first()
          Select the first card in the Panel.
 boolean getClosable()
           
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 java.awt.Component getTopComponent()
          Component Selection
 java.awt.Insets insets()
          Allocates extra margins to give the cards some `body'.
 void last()
          Select the last card in the Panel.
 void layout()
          Computes tab geometry while laying out the panels components.
 void mouseClicked(java.awt.event.MouseEvent p1)
           
 void mouseEntered(java.awt.event.MouseEvent p1)
           
 void mouseExited(java.awt.event.MouseEvent p1)
           
 void mousePressed(java.awt.event.MouseEvent p1)
           
 void mouseReleased(java.awt.event.MouseEvent p1)
           
 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 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 setClosable(boolean b)
           
 void setLabel(java.lang.String name, java.lang.String label)
          Add a card, component, to the TabPanel with a given name.
 void setMinimumSize(java.awt.Dimension d)
           
 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, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, 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, 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, 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

getClosable

public boolean getClosable()

setClosable

public void setClosable(boolean b)

setLabel

public void setLabel(java.lang.String name,
                     java.lang.String label)
Add a card, component, to the TabPanel with a given name.


add

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

add

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

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.


getTopComponent

public java.awt.Component getTopComponent()
Component Selection


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.


insets

public java.awt.Insets insets()
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.


setMinimumSize

public void setMinimumSize(java.awt.Dimension d)

getPreferredSize

public java.awt.Dimension getPreferredSize()

getMinimumSize

public java.awt.Dimension getMinimumSize()

layout

public void layout()
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.


mouseReleased

public void mouseReleased(java.awt.event.MouseEvent p1)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent p1)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent p1)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent p1)
Specified by:
mousePressed in interface java.awt.event.MouseListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent p1)
Specified by:
mouseExited in interface java.awt.event.MouseListener