com.sshtools.ui.awt
Class TabbedPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by com.sshtools.ui.awt.TabbedPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class TabbedPanel
extends java.awt.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.

Author:
$Author: lee $
See Also:
Serialized Form

Nested Class Summary
 
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
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
 
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
TabbedPanel(int position)
           Create a tabbed panel with the tabs at the specified position.
 
Method Summary
 void add(java.awt.Component comp, java.lang.Object constraints, java.awt.Image image)
           
 void add(java.awt.Component comp, java.lang.Object constraints, int index, java.awt.Image image)
          Add a tab.
 void addActionListener(java.awt.event.ActionListener l)
          Add an ActionListener to be informed when the user selects a tab.
protected  void addImpl(java.awt.Component comp, java.lang.Object constraints, int index)
           
 void addNotify()
           
 java.awt.Insets getInsets()
           
 int getPosition()
           
 int getSelectedTab()
          Get the index of the currently selected tab
 int getSelectedTabIndex()
           
static void main(java.lang.String[] args)
           
 void paint(java.awt.Graphics g)
           
 void remove(int idx)
           
 void removeActionListener(java.awt.event.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, java.lang.String title)
          Set the title of a tab at the given index
 
Methods inherited from class java.awt.Container
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, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, getAccessibleContext, 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, 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, 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

TOP

public static final int TOP
Tabs are placed above the components

See Also:
Constant Field Values

LEFT

public static final int LEFT
Tabs are placed to the left of the components

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Tabs are placed below the components

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Tabs are placed to the right of the components

See Also:
Constant Field Values
Constructor Detail

TabbedPanel

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

Parameters:
position - position
Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Add an ActionListener to be informed when the user selects a tab.

Parameters:
l - listener to add

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Remove an ActionListener so as to no longer be informed when the user selects a tab.

Parameters:
l - listener to remove

setTitleAt

public void setTitleAt(int i,
                       java.lang.String title)
Set the title of a tab at the given index

Parameters:
i - index of tab
title - new tab title

setSelectedTab

public void setSelectedTab(int idx)
Set the selected tab given its index.

Parameters:
idx - index of tab to select

getSelectedTab

public int getSelectedTab()
Get the index of the currently selected tab

Returns:
selected tab index

setPosition

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

Parameters:
position - position

remove

public void remove(int idx)
Overrides:
remove in class java.awt.Container

add

public void add(java.awt.Component comp,
                java.lang.Object constraints,
                int index,
                java.awt.Image image)
Add a tab.

Parameters:
comp - component
constraints - tab name
index - tab index
image - tab image

getPosition

public int getPosition()

removeNotify

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

addImpl

protected void addImpl(java.awt.Component comp,
                       java.lang.Object constraints,
                       int index)
Overrides:
addImpl in class java.awt.Container

add

public void add(java.awt.Component comp,
                java.lang.Object constraints,
                java.awt.Image image)

getInsets

public java.awt.Insets getInsets()
Overrides:
getInsets in class java.awt.Container

addNotify

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

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Container

main

public static void main(java.lang.String[] args)

getSelectedTabIndex

public int getSelectedTabIndex()
Returns:


Copyright © 2003-2004 3SP LTD. All Rights Reserved.