|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
com.objectplanet.gui.tabs.TabbedPanel
This class implements a tabbed panel component. You can place any component in the panel, and each component will have a named tab assosiated with it. The user can choose between the components by selecting the tabs.
The tabs can be either at the top, bottom, left, or right of the panel. The user can also detach a tab into its own top-level window.
The user can detach a component into its own window by selecting a tab with the right mouse button. The component will then be detached into it's own top-level application window which the user can change the size of. The window is reattached to the tabbed panel by closing it.
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 | |
static int |
BOTTOM
Tabs go at the bottom. |
static int |
LEFT
Tabs go at the left. |
static int |
RIGHT
Tabs go at the right. |
static int |
TOP
Tabs go at the top. |
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()
Creates an empty TabbedPanel with the tabs at the top. |
|
TabbedPanel(int orientation)
Creates an empty TabbedPanel with the given tab orientation. |
Method Summary | |
java.awt.Component |
add(java.lang.String name,
java.awt.Component component)
Adds a new component to the panel. |
void |
addMouseListener(java.awt.event.MouseListener listener)
Adds a mouse listener to the tabbed panel. |
void |
addTabbedListener(TabbedListener listener)
Adds a tabbed panel event listener. |
boolean |
contains(java.lang.String name)
Checks if a tab with this name exists in the panel. |
void |
destroy()
Call this method to release any image resources used. |
java.awt.Frame |
detach(java.lang.String tab)
Detaches the specified tab into a top-level window. |
java.awt.Frame |
detachAll()
Detaches all the tabs into it's own top-level window frame. |
void |
doLayout()
Lays out the current visible component. |
java.awt.Component |
get(java.lang.String name)
Gets the component with the given name from the panel. |
int |
getBorderSize()
Gets the size of the border. |
java.awt.Image |
getDetachedIcon(java.lang.String name)
Gets the icon used for the detached frame. |
java.awt.Image |
getDetachedImage()
Gets the detach image. |
java.lang.String |
getDetachedTitle()
Gets the title used in the detached window frame. |
java.awt.Insets |
getInsets()
This method is overridden to pad the panel to make space for the tabs. |
int |
getOrientation()
Gets the current orientation of the tabs. |
java.lang.String |
getShowing()
Gets the name of the tab currently showed. |
java.awt.Color |
getTabColor()
Gets the default color of the tabs. |
java.awt.Color |
getTabColor(java.lang.String tab)
Gets the color of the specified tab. |
int |
getTabCount()
Gets the number of tabs in the panel. |
java.awt.Font |
getTabFont()
Gets the font used for the tab labels. |
java.awt.Image |
getTabImage(java.lang.String name)
Gets the image used for the specified tab. |
java.awt.Color |
getTabLabelColor()
Gets the default color of the tab labels. |
java.awt.Color |
getTabLabelColor(java.lang.String tab)
Gets the color of the specified tab label. |
java.lang.String |
getTabName(int index)
Gets the name of the specified tab. |
java.lang.String |
getTitle()
Gets the title of the panel. |
java.awt.Font |
getTitleFont()
Gets the title font. |
boolean |
isAllDetachable()
Checks if all the tabs can be detached at once. |
boolean |
isAllDetached()
Checks if all the tabs (as one component) is detached into it's own top-level window frame. |
boolean |
isAnyDetached()
Checks if any given tab is detached. |
boolean |
isDetachable()
Checks if the tabs in the panel are detachable. |
boolean |
isDetached(java.lang.String tab)
Checks if the given tab is detached. |
boolean |
isDoLayoutOn()
Checks if automatic layout is on. |
boolean |
isDoubleBufferingOn()
Checks if double buffering is turned on or off. |
boolean |
isEnabled(java.lang.String tab)
Checks if the given tab is enabled or disabled. |
boolean |
isShowing(java.lang.String tab)
Checks if the given tab is the one currently showing. |
boolean |
isTabImageOn(java.lang.String name)
Checks if the tab image for the specified tab is turned on. |
boolean |
isTabLabelOn(java.lang.String name)
Checks if the tab label for the specified tab is turned on. |
boolean |
isTabsOn()
Checks if the tabs are on or off. |
java.awt.Component |
remove(java.lang.String name)
Removes the component with the given name from the panel. |
void |
removeTabbedListener(TabbedListener listener)
Removes the specified event listener from the panel. |
protected void |
render(java.awt.Graphics g,
TabbedContainer container)
Renders the tabs. |
void |
repaint()
The tab contains is the actual component the buttons are painted on. |
void |
retach(java.lang.String tab)
Reattaches a component that has been detached from the panel. |
void |
retachAll()
Retaches all the back into the main tabbed panel container. |
void |
setAllDetachable(boolean detachable)
Turns on or off the possibility to detach all the tabs at once tabs into it's own top-level window frame. |
void |
setBorderSize(int size)
Sets the tab's border size. |
void |
setDetachable(boolean detachable)
Turns on or off the possibility to detach a tab. |
void |
setDetachedIcon(java.lang.String name,
java.awt.Image image)
Sets the icon used for the detached frame. |
void |
setDetachedImage(java.awt.Image image)
Sets the image to be painted on the component when all the tabs are detached. |
void |
setDetachedTitle(java.lang.String title)
Sets the title used in the detached window frame. |
void |
setDoLayoutOn(boolean state)
Turns on or off automatic layout. |
void |
setDoubleBufferingOn(boolean state)
Turns on or off double buffering. |
void |
setEnabled(java.lang.String tab,
boolean enabled)
Enables or disables the given tab. |
void |
setOrientation(int orientation)
Sets the orientation of the tabs. |
void |
setTabColor(java.awt.Color color)
Sets the color of the tabs. |
void |
setTabColor(java.lang.String tab,
java.awt.Color color)
Sets the color of the specified tab. |
void |
setTabFont(java.awt.Font font)
Sets the font used for the tab labels. |
void |
setTabImage(java.lang.String name,
java.awt.Image image)
Sets an image for the specified tab. |
void |
setTabImageOn(java.lang.String name,
boolean on)
Turns on or off the image of the specified tab. |
void |
setTabLabelColor(java.awt.Color color)
Sets the color of the tab labels. |
void |
setTabLabelColor(java.lang.String tab,
java.awt.Color color)
Sets the color of the specified tab label. |
void |
setTabLabelOn(java.lang.String name,
boolean on)
Turns on or off the label of the specified tab. |
void |
setTabsOn(boolean on)
Turns on or off the tabs. |
void |
setTitle(java.lang.String title)
Sets the title of the panel. |
void |
setTitleFont(java.awt.Font font)
Sets the font of the title. |
java.awt.Component |
show(java.lang.String name)
Shows the component with the given name. |
void |
update(java.awt.Graphics g)
Implemented to avoid flicker. |
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, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, 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, 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, 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 |
public static final int BOTTOM
public static final int LEFT
public static final int RIGHT
public static final int TOP
Constructor Detail |
public TabbedPanel()
public TabbedPanel(int orientation)
orientation
- The tab bar orientation (TOP, BOTTOM, LEFT, RIGHT).Method Detail |
public java.awt.Component add(java.lang.String name, java.awt.Component component)
name
- The name of the tab for the component.component
- The component to add.
remove(java.lang.String)
public void addMouseListener(java.awt.event.MouseListener listener)
listener
- The mouse listener to add.public void addTabbedListener(TabbedListener listener)
listener
- The listener to addremoveTabbedListener(com.objectplanet.gui.tabs.TabbedListener)
public boolean contains(java.lang.String name)
name
- The name to check for.
public void destroy()
public java.awt.Frame detach(java.lang.String tab)
tab
- The name of the tab to detach, or null if it failed.retach(java.lang.String)
public java.awt.Frame detachAll()
public void doLayout()
public java.awt.Component get(java.lang.String name)
name
- The name of the tab for the component.
public int getBorderSize()
public java.awt.Image getDetachedIcon(java.lang.String name)
name
- The name of the tab or null for default and the detachAll frame icon.
public java.awt.Image getDetachedImage()
public java.lang.String getDetachedTitle()
public java.awt.Insets getInsets()
public int getOrientation()
public java.lang.String getShowing()
public java.awt.Color getTabColor()
public java.awt.Color getTabColor(java.lang.String tab)
tab
- The name of the tab.public int getTabCount()
public java.awt.Font getTabFont()
public java.awt.Image getTabImage(java.lang.String name)
name
- The name of the tab.
public java.awt.Color getTabLabelColor()
public java.awt.Color getTabLabelColor(java.lang.String tab)
tab
- The name of the tab.public java.lang.String getTabName(int index)
index
- The index of the tab (0-based).
public java.lang.String getTitle()
public java.awt.Font getTitleFont()
public boolean isAllDetachable()
public boolean isAllDetached()
public boolean isAnyDetached()
public boolean isDetachable()
public boolean isDetached(java.lang.String tab)
tab
- The name of the tab to check.
public boolean isDoLayoutOn()
public boolean isDoubleBufferingOn()
public boolean isEnabled(java.lang.String tab)
tab
- The name of the tab.
setEnabled(java.lang.String, boolean)
public boolean isShowing(java.lang.String tab)
tab
- The name of the tab to check.
show(java.lang.String)
public boolean isTabImageOn(java.lang.String name)
name
- The name of the tab.
public boolean isTabLabelOn(java.lang.String name)
name
- The name of the tab.
public boolean isTabsOn()
public java.awt.Component remove(java.lang.String name)
name
- The name of the tab for the component.
add(java.lang.String, java.awt.Component)
public void removeTabbedListener(TabbedListener listener)
listener
- The event listener to remove.addTabbedListener(com.objectplanet.gui.tabs.TabbedListener)
protected void render(java.awt.Graphics g, TabbedContainer container)
g
- The graphics context used for painting.container
- The tab container to paint the tabs on.public void repaint()
public void retach(java.lang.String tab)
tab
- The name of the tab that is to be reattached again.detach(java.lang.String)
public void retachAll()
public void setAllDetachable(boolean detachable)
detachable
- True for detachable, false otherwise.public void setBorderSize(int size)
size
- The size in pixels, 0 for off.public void setDetachable(boolean detachable)
detachable
- True for detachable, false otherwise.public void setDetachedIcon(java.lang.String name, java.awt.Image image)
name
- The name of the tab or null for default and the detachAll frame icon.image
- The icon image to use, null for none.public void setDetachedImage(java.awt.Image image)
image
- The image to be used, null for none.public void setDetachedTitle(java.lang.String title)
title
- The frame title.public void setDoLayoutOn(boolean state)
state
- True for automatic layout, false for manual.public void setDoubleBufferingOn(boolean state)
state
- True for on (default), false for off.public void setEnabled(java.lang.String tab, boolean enabled)
tab
- The name of the tab.enabled
- True for enabled, false for disabled.isEnabled(java.lang.String)
public void setOrientation(int orientation)
orientation
- TOP, BOTTOM, LEFT, or RIGHT.public void setTabColor(java.awt.Color color)
color
- The color to use.public void setTabColor(java.lang.String tab, java.awt.Color color)
tab
- The name of the tab.color
- The color to use (null to use default tab color).setTabColor(java.awt.Color)
public void setTabFont(java.awt.Font font)
font
- The font to use.public void setTabImage(java.lang.String name, java.awt.Image image)
name
- The name of the tab.image
- The image to use, null for none.public void setTabImageOn(java.lang.String name, boolean on)
name
- The name of the tab.on
- True for on, false for off.public void setTabLabelColor(java.awt.Color color)
color
- The color to use.public void setTabLabelColor(java.lang.String tab, java.awt.Color color)
tab
- The name of the tab.color
- The color to use (null to use default tab label color).setTabLabelColor(java.awt.Color)
public void setTabLabelOn(java.lang.String name, boolean on)
name
- The name of the tab.on
- True for on, false for off.public void setTabsOn(boolean on)
on
- True for on, false for off.public void setTitle(java.lang.String title)
title
- The title or null if no title should be used.public void setTitleFont(java.awt.Font font)
font
- The font to use.public java.awt.Component show(java.lang.String name)
name
- The name of the tab for the component.
public void update(java.awt.Graphics g)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |