org.xnap.gui.component
Class ToggleableIconPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.xnap.gui.component.ToggleableIconPane
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener

public class ToggleableIconPane
extends javax.swing.JPanel
implements javax.swing.event.ChangeListener

Provides a container that can display multiple panels. The view can be switched between a JTabbedPane view and an IconSplitPane view.

See Also:
Serialized Form

Nested Class Summary
protected  class ToggleableIconPane.Blinker
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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 BLINK_INTERVAL
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
ToggleableIconPane(boolean tabbed)
          Constructs a ToggleableIconPane in tabbed mode if tabbed is true.
ToggleableIconPane(boolean tabbed, int dividerSize)
          Constructs a ToggleableIconPane in tabbed mode if tabbed is true and given dividerSize for the IconSplitPane.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds a ChangeListener to this toggableiconpane.
 void addTab(java.lang.String description, javax.swing.Icon icon, javax.swing.JComponent c)
          Adds a component, represented by a description and/or icon.
 void blink(int i, javax.swing.Icon blinkIcon)
          Sets a blinking icon for the component at index i.
 javax.swing.Icon getIconAt(int i)
          Returns the icon at index i.
 java.awt.Component getSelectedComponent()
          Returns the currently selected component for this toggableiconpane.
 int getSelectedIndex()
          Returns the index of the currently selected component.
 int getTabCount()
          Returns the number of child components.
 java.awt.Component[] getTabs()
          Returns all the components in this container.
 int indexOfComponent(java.awt.Component c)
          Returns the index of the tab/icon for the specified component.
 void insertTab(java.lang.String description, javax.swing.Icon icon, javax.swing.JComponent c, int index)
          Inserts a component, at index, represented by a description and/or icon.
 void putTabClientProperty(java.lang.Object key, java.lang.Object value)
           
 void remove(java.awt.Component c)
          Removes the specified component from the ToggleableIconPane.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removes a ChangeListener from this toggableiconpane.
 void setDividerSize(int newSize)
          Sets the divider size for the IconSplitPane view.
 void setIconAt(int i, javax.swing.Icon icon)
          Sets the icon at index i.
 void setSelectedComponent(java.awt.Component c)
          Selects the given child component.
 void setSelectedComponent(java.lang.String description)
          Selects the tab/icon having the given description.
 void setTabbed(boolean newValue)
          Toggles between the TabbedPane view and the IconSplitPane view.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Implements the ChangeListener interface.
 void unblink()
          Stops blinking and restores the original icon for the blinking tab/icon.
protected  void updateClientProperties()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, 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

BLINK_INTERVAL

public static final int BLINK_INTERVAL
See Also:
Constant Field Values
Constructor Detail

ToggleableIconPane

public ToggleableIconPane(boolean tabbed,
                          int dividerSize)
Constructs a ToggleableIconPane in tabbed mode if tabbed is true and given dividerSize for the IconSplitPane.

Parameters:
tabbed - if true the TabbedPane is the active view, otherwise it's the IconSplitPane
dividerSize - the size of the divider for the IconSplitPane view

ToggleableIconPane

public ToggleableIconPane(boolean tabbed)
Constructs a ToggleableIconPane in tabbed mode if tabbed is true.

Parameters:
tabbed - if true the TabbedPane is the active view, otherwise it is the IconSplitPane
Method Detail

insertTab

public void insertTab(java.lang.String description,
                      javax.swing.Icon icon,
                      javax.swing.JComponent c,
                      int index)
Inserts a component, at index, represented by a description and/or icon.

Parameters:
description - the title for this component
icon - the icon to be displayed representing the component
c - the component to be displayed when the respective tab/icon is clicked
index - the position where the component is inserted

addTab

public void addTab(java.lang.String description,
                   javax.swing.Icon icon,
                   javax.swing.JComponent c)
Adds a component, represented by a description and/or icon.

Parameters:
description - the title for this component
icon - the icon to be displayed representing the component
c - the component to be displayed when the respective tab/icon is clicked

getTabs

public java.awt.Component[] getTabs()
Returns all the components in this container.

Returns:
an array of all child components of this container

indexOfComponent

public int indexOfComponent(java.awt.Component c)
Returns the index of the tab/icon for the specified component. Returns the index of the tab for the specified component. Returns -1 if there is no tab for this component.

Parameters:
component - - the component for the tab/icon
Returns:
the first tab which matches this component, or -1 if there is no tab/icon for this component.

setDividerSize

public void setDividerSize(int newSize)
Sets the divider size for the IconSplitPane view.

Parameters:
newSize - an integer giving the size of the divider in pixels

remove

public void remove(java.awt.Component c)
Removes the specified component from the ToggleableIconPane.

Overrides:
remove in class java.awt.Container
Parameters:
c - the componennt which is to be removed

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Adds a ChangeListener to this toggableiconpane.

Parameters:
l - the changelistener to add

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener from this toggableiconpane.

Parameters:
l - the changelistener to remove

getIconAt

public javax.swing.Icon getIconAt(int i)
Returns the icon at index i.

Parameters:
i - the index of the item being queried
Returns:
the icon at index i

setIconAt

public void setIconAt(int i,
                      javax.swing.Icon icon)
Sets the icon at index i.

Parameters:
i - the index of the item being set
icon - the icon to be set

blink

public void blink(int i,
                  javax.swing.Icon blinkIcon)
Sets a blinking icon for the component at index i. There is only one icon blinking at a time.

Parameters:
i - the index of the item being blinked
blinkIcon - the icon which blinks.

unblink

public void unblink()
Stops blinking and restores the original icon for the blinking tab/icon.


getSelectedIndex

public int getSelectedIndex()
Returns the index of the currently selected component. Returns -1 if there is no currently selected component.

Returns:
the index of the selected component

getSelectedComponent

public java.awt.Component getSelectedComponent()
Returns the currently selected component for this toggableiconpane. Returns null if there is no currently selected component.

Returns:
the component corresponding to the selected tab/icon

getTabCount

public int getTabCount()
Returns the number of child components.


putTabClientProperty

public void putTabClientProperty(java.lang.Object key,
                                 java.lang.Object value)

setSelectedComponent

public void setSelectedComponent(java.lang.String description)
Selects the tab/icon having the given description.


setSelectedComponent

public void setSelectedComponent(java.awt.Component c)
Selects the given child component.


setTabbed

public void setTabbed(boolean newValue)
Toggles between the TabbedPane view and the IconSplitPane view.

Parameters:
newValue - whether or not the new view is the tabbed view

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Implements the ChangeListener interface.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener

updateClientProperties

protected void updateClientProperties()


Copyright © 2001-2005 XNap Team. All Rights Reserved.