amber.awt
Class TabPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--amber.awt.TabPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable

public class TabPanel
extends java.awt.Panel
implements java.awt.ItemSelectable

This panel controls a series of tabs and related panels. Only one panel is visible at any one time. The tabs control which tab is visible.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
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()
           
 
Method Summary
 void add(java.lang.String name, java.awt.Container panel)
          This function adds a new tab to the panel.
 void add(java.lang.String name, java.awt.Container panel, int index)
          This function adds a new tab to the panel at specified index.
 void addItemListener(java.awt.event.ItemListener l)
           
 void addNotify()
           
 void doLayout()
           
protected  void fireItemStateChanged(java.awt.event.ItemEvent e)
           
 void first()
          Flip to the first tab and display it.
 java.awt.Container getPanel(int index)
          This function returns the tab panel handle at the specified index.
 int getPanelCount()
          This function returns the number of panels in the tab panel.
 int getSelectedIndex()
          This function returns the currently selected tab if any.
 java.lang.Object[] getSelectedObjects()
           
protected  int identifyTab(java.awt.event.MouseEvent e)
          This function takes the mouse event and identifies which tab was clicked if any.
 boolean isTabChangeEnabled()
          Returns the state of the tab change flag.
 void last()
          Flip to the last tab and display it.
 void next()
          Flip to the next tab in the list and display it.
 void paint(java.awt.Graphics g)
          This is the primary drawing function for the panel.
 void previous()
          Flip to the previous tab in the list and display it.
protected  void processMouseEvent(java.awt.event.MouseEvent e)
           
 void remove(int index)
          This function removes a specified tab from the panel.
 void remove(java.lang.String name)
          This function removes a specified tab from the panel.
 void removeAll()
          This function removes all tabs.
 void removeItemListener(java.awt.event.ItemListener l)
           
 void rename(java.lang.String name, int index)
          This function renames the tab at specified index.
 void setTabChangeEnabled(boolean state)
          Sets the state of the tab change flag.
 void show(int index)
          Show the specified tab as defined by the name.
 void show(java.lang.String name)
          Show the specified tab as defined by the name.
 
Methods inherited from class java.awt.Panel
getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TabPanel

public TabPanel()
Method Detail

first

public void first()
Flip to the first tab and display it.

last

public void last()
Flip to the last tab and display it.

next

public void next()
Flip to the next tab in the list and display it.

previous

public void previous()
Flip to the previous tab in the list and display it.

getPanel

public java.awt.Container getPanel(int index)
This function returns the tab panel handle at the specified index.
Parameters:
index - int index of the panel to get.
Returns:
Container which is at this index.

getPanelCount

public int getPanelCount()
This function returns the number of panels in the tab panel.
Returns:
int Panel count.

add

public void add(java.lang.String name,
                java.awt.Container panel)
This function adds a new tab to the panel.
Parameters:
name - String containing the name of the tab.
panel - Container to add to the tab panel.

add

public void add(java.lang.String name,
                java.awt.Container panel,
                int index)
This function adds a new tab to the panel at specified index.
Parameters:
name - String containing the name of the tab.
panel - Panel to add to the tab panel.
index - int containing the index location where the tab is to be placed.

rename

public void rename(java.lang.String name,
                   int index)
This function renames the tab at specified index.
Parameters:
name - String containing the name of the tab.
index - int containing the index location of the tab to rename.

remove

public void remove(java.lang.String name)
This function removes a specified tab from the panel.
Parameters:
name - String containing the name of the tab to remove.

remove

public void remove(int index)
This function removes a specified tab from the panel.
Overrides:
remove in class java.awt.Container
Parameters:
index - int index of the tab to remove.

removeAll

public void removeAll()
This function removes all tabs.
Overrides:
removeAll in class java.awt.Container

show

public void show(java.lang.String name)
Show the specified tab as defined by the name.
Parameters:
name - String name of the tab to display.

show

public void show(int index)
Show the specified tab as defined by the name.
Parameters:
index - int index of the tab to display.

setTabChangeEnabled

public void setTabChangeEnabled(boolean state)
Sets the state of the tab change flag. If the state is true (default) the tab panel changes the tab when the corresponding tab is clicked.
Parameters:
state - boolean stating whether the tab change should occur.

isTabChangeEnabled

public boolean isTabChangeEnabled()
Returns the state of the tab change flag. If the state is true (default) the tab panel changes the tab when the corresponding tab is clicked.
Returns:
boolean stating whether the tab change should occur.

getSelectedIndex

public int getSelectedIndex()
This function returns the currently selected tab if any.
Returns:
int tab index which is currently selected. -1 if no tab selected.

doLayout

public void doLayout()
Overrides:
doLayout in class java.awt.Container

paint

public void paint(java.awt.Graphics g)
This is the primary drawing function for the panel. It is overriden to allow the top panel containing the tabs to be drawn.
Overrides:
paint in class java.awt.Container
Parameters:
g - Graphics context of the main panel.

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Overrides:
processMouseEvent in class java.awt.Component

identifyTab

protected int identifyTab(java.awt.event.MouseEvent e)
This function takes the mouse event and identifies which tab was clicked if any.
Parameters:
e - MouseEvent to identify the location of.
Returns:
int index to the selected tab or -1 if no tab clicked.

addNotify

public void addNotify()
Overrides:
addNotify in class java.awt.Panel

removeItemListener

public void removeItemListener(java.awt.event.ItemListener l)
Specified by:
removeItemListener in interface java.awt.ItemSelectable

addItemListener

public void addItemListener(java.awt.event.ItemListener l)
Specified by:
addItemListener in interface java.awt.ItemSelectable

fireItemStateChanged

protected void fireItemStateChanged(java.awt.event.ItemEvent e)

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Specified by:
getSelectedObjects in interface java.awt.ItemSelectable


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.