net.xoetrope.awt
Class XTabPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by net.xoetrope.awt.XPanel
                  extended by net.xoetrope.awt.XTabPanel
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, XAttributedComponent

public class XTabPanel
extends XPanel

    
implements java.awt.event.MouseListener

    

A tab panel. The methods are modelled on the JTabbedPane

Copyright (c) Xoetrope Ltd., 1998-2004
License: see license.txt $Revision: 2.2 $

See Also:
Serialized Form

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
protected  java.awt.CardLayout cardManager
           
protected  XPanel contentPane
           
protected  int selIdx
           
protected  XPanel tabPane
           
 
Fields inherited from class net.xoetrope.awt.XPanel
BORDER_BEVEL, BORDER_FLAT, BORDER_NONE
 
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
XTabPanel()
          Create a new tab panel
 
Method Summary
 java.awt.Component add(java.awt.Component comp)
          Add a new tab.
 void addTab(java.lang.String name, java.awt.Component panel)
          Add a new tab.
 java.awt.Color getBackgroundAt(int index)
          Get a tab's background color
 java.awt.Component getComponentAt(int index)
          Get the tab component at the specified index
 java.awt.Color getForegroundAt(int index)
          Get a tab's foreground color
 int getSelectedIndex()
          Get the index of the selected tab
 int getTabCount()
          Get the number of tabs
 java.lang.String getTitleAt(int index)
          Get the title of the tab at the specified index
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse button has been clicked (pressed and released) on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
 void setBackgroundAt(int index, java.awt.Color clr)
          Set the tab background color
 void setDrawFrame(int value)
          Toggle the frame display.
 void setForegroundAt(int index, java.awt.Color clr)
          Set the foreground color
 void setSelectedIndex(int index)
          Select a tab
 void setTitleAt(int index, java.lang.String str)
          Set a tab's title
 
Methods inherited from class net.xoetrope.awt.XPanel
addNotify, getDrawFrame, paint, setAttribute, setBounds
 
Methods inherited from class java.awt.Panel
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, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, 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, remove, removeAll, removeContainerListener, removeNotify, 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, 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, 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

tabPane

protected XPanel tabPane

contentPane

protected XPanel contentPane

selIdx

protected int selIdx

cardManager

protected java.awt.CardLayout cardManager
Constructor Detail

XTabPanel

public XTabPanel()
Create a new tab panel

Method Detail

add

public java.awt.Component add(java.awt.Component comp)
Add a new tab. The add method could not be overloaded so this method adds does the equivalent.

Overrides:
add in class java.awt.Container
Parameters:
comp - the new tab component
Returns:
the new component

addTab

public void addTab(java.lang.String name,
                   java.awt.Component panel)
Add a new tab. The add method could not be overloaded so this method adds does the equivalent.

Parameters:
name - the name/caption of the tab component
panel - the content

getComponentAt

public java.awt.Component getComponentAt(int index)
Get the tab component at the specified index

Parameters:
index - the tab index
Returns:
the tab component

getBackgroundAt

public java.awt.Color getBackgroundAt(int index)
Get a tab's background color

Parameters:
index - the tab index
Returns:
the color

getForegroundAt

public java.awt.Color getForegroundAt(int index)
Get a tab's foreground color

Parameters:
index - the tab index
Returns:
the color

getTabCount

public int getTabCount()
Get the number of tabs

Returns:
the number of tabs

getSelectedIndex

public int getSelectedIndex()
Get the index of the selected tab

Returns:
the selection index

getTitleAt

public java.lang.String getTitleAt(int index)
Get the title of the tab at the specified index

Parameters:
index - the tab index
Returns:
the tab text/title

setBackgroundAt

public void setBackgroundAt(int index,
                            java.awt.Color clr)
Set the tab background color

Parameters:
index - the tab index
clr - the new colr

setForegroundAt

public void setForegroundAt(int index,
                            java.awt.Color clr)
Set the foreground color

Parameters:
index - the tab index
clr - the new color

setSelectedIndex

public void setSelectedIndex(int index)
Select a tab

Parameters:
index - the tab index

setTitleAt

public void setTitleAt(int index,
                       java.lang.String str)
Set a tab's title

Parameters:
index - the tab index
str - the text for the tab

setDrawFrame

public void setDrawFrame(int value)
Toggle the frame display. The frame is drawn around the content pane

Overrides:
setDrawFrame in class XPanel
Parameters:
value - 0 for no frame, 1 for a bevel, 2 for a flat frame

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - the event

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - the event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - the event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - the event

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - the event