| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.cosylab.gui.components.TitledPanel
public class TitledPanel
TitledPanel is an extension of the Swing's JPanel, which contains a
 PanelTitleBar at the top. The rest of the panel's space is
 occupied by the content read-write property, which  is an
 arbitrary Component. By default, the content property is set
 to null. 
 The title bar shows an Icon which is passed as a parameter to
 the constructor, and  a String read-write property named
 title. Toolbar buttons can be added to the panel using the
 addTitleBarButton() method, passing a JButton as
 a parameter. The buttons added to the panel may be associated with an
 arbitrary action, which will not be affected by the TitledPanel.Note that
 buttons will not retain their original color,  border or size after being
 added to the TitledPanel. 
 Width of the title bar (and thus also the size of the toolbar buttons) and
 the space between the panel's border and its content  can both be
 determined when constructing the panel.
PanelTitleBar, 
JPanel, 
Serialized Form| Nested Class Summary | 
|---|
| 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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy | 
| Field Summary | |
|---|---|
| protected  PanelTitleBar | bar | 
| 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 | |
|---|---|
| TitledPanel()Creates a new TitledPanel object. | |
| TitledPanel(java.lang.String name,
            java.lang.String title,
            javax.swing.Icon icon)Constructor for TitledPanel. | |
| TitledPanel(java.lang.String name,
            java.lang.String title,
            javax.swing.Icon icon,
            int titleBarHeight)Constructor for TitledPanel. | |
| Method Summary | |
|---|---|
|  java.awt.Component | add(java.awt.Component comp) | 
|  java.awt.Component | add(java.awt.Component comp,
    int index) | 
|  void | add(java.awt.Component comp,
    java.lang.Object constraints) | 
|  void | add(java.awt.Component comp,
    java.lang.Object constraints,
    int index) | 
|  java.awt.Component | add(java.lang.String name,
    java.awt.Component comp) | 
|  void | addNotify() | 
|  void | addTitleBarAction(javax.swing.Action action)Adds a button activating the specified action to this panel's title bar. | 
|  void | addTitleBarAction(int index,
                  javax.swing.Action action)Adds a button activating the specified action to this panel's title bar at specified index. | 
|  void | addTitleBarButton(javax.swing.AbstractButton button)Adds a JButtonto this panel's title bar. | 
|  void | addTitleBarButton(int index,
                  javax.swing.AbstractButton button)Adds a button to this panel's title bar at specified index. | 
|  boolean | containsTitleBarAction(javax.swing.AbstractButton button) | 
|  boolean | containsTitleBarAction(javax.swing.Action action) | 
|  java.awt.Container | getContentPane()Gets the contentContainer. | 
|  javax.swing.Icon | getIcon()Return this panel's title bar icon. | 
|  java.lang.String | getTitle()Gets the title. | 
|  java.awt.Color | getTitleBackgroundLeft()Returns the left background color of this panel's title bar. | 
|  java.awt.Color | getTitleBackgroundRight()Gets the right background color of this panel's title bar. | 
| protected  GradientLabel | getTitleBarLabel() | 
|  boolean | isTitleBarVisible()Returns true if title bar is visible or false otherwise. | 
|  void | remove(java.awt.Component comp) | 
|  void | removeTitleBarAction(javax.swing.Action action)Removes the button associated with the specified action from this panel's title bar. | 
|  void | removeTitleBarButton(javax.swing.AbstractButton button)Removes a button from this panel's title bar. | 
|  void | setContentPane(java.awt.Container content)Sets the content. | 
|  void | setFont(java.awt.Font font) | 
|  void | setIcon(javax.swing.Icon icon)Sets the icon of this panel's title bar. | 
|  void | setTitle(java.lang.String title)Sets this panel's title, which is diaplayed in the title bar. | 
|  void | setTitleBackground(java.awt.Color left,
                   java.awt.Color right)Sets the background colors of this panel's title bar. | 
|  void | setTitleBackgroundLeft(java.awt.Color left)Sets the background colors of this panel's title bar. | 
|  void | setTitleBackgroundRight(java.awt.Color right)Sets the background colors of this panel's title bar. | 
|  void | setTitleBarVisible(boolean visible)Sets the visibility of the title bar. | 
| Methods inherited from class javax.swing.JPanel | 
|---|
| getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI | 
| Methods inherited from class javax.swing.JComponent | 
|---|
| addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, 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, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update | 
| Methods inherited from class java.awt.Container | 
|---|
| 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 | 
|---|
protected PanelTitleBar bar
| Constructor Detail | 
|---|
public TitledPanel(java.lang.String name,
                   java.lang.String title,
                   javax.swing.Icon icon)
PanelTitleBar. The title bar will be
 created with the default width of 24 pixels and there will be no space
 between the border of the panel and its contents (titlebar and
 content component)
name - The name of the panel.title - The title which will be displayed in the title bar.icon - The icon to be rendered in the upper-left corner of the
        panel.public TitledPanel()
public TitledPanel(java.lang.String name,
                   java.lang.String title,
                   javax.swing.Icon icon,
                   int titleBarHeight)
PanelTitleBar.
name - The name of the panel.title - The title which will be displayed in the title bar.icon - The icon to be rendered in the upper-left corner of the
        panel.titleBarHeight - Height of the title bar rendered in the top area
        of the panel.| Method Detail | 
|---|
public void addTitleBarButton(javax.swing.AbstractButton button)
JButton to this panel's title bar. Note that all the
 user has to provide is the button's icon and an associated action. All
 the behaviour needed for the button to fit into the title bar will be
 added to the button by the PanelTitleBar.  The button will be resized
 to a square with the same size as the  height of the bar. Its
 background color will be changed  to that of the bar and the border
 will be removed.  Some mouse and keyboard sensitivity will be added to
 the button.
button - The button to be added to the title bar.
public void addTitleBarButton(int index,
                              javax.swing.AbstractButton button)
index - location of added buttonbutton - public void removeTitleBarButton(javax.swing.AbstractButton button)
button - public void addTitleBarAction(javax.swing.Action action)
action - 
public void addTitleBarAction(int index,
                              javax.swing.Action action)
index - location of added actionaction - public boolean containsTitleBarAction(javax.swing.Action action)
PanelTitleBar.containsAction(Action)public boolean containsTitleBarAction(javax.swing.AbstractButton button)
PanelTitleBar.containsButton(AbstractButton)public void removeTitleBarAction(javax.swing.Action action)
action - public void setTitle(java.lang.String title)
title - The text that should be displayed as the title.public java.lang.String getTitle()
String displayed as the title.getTitle()public java.awt.Color getTitleBackgroundLeft()
public java.awt.Color getTitleBackgroundRight()
public void setTitleBackground(java.awt.Color left,
                               java.awt.Color right)
left - right - public void setTitleBackgroundLeft(java.awt.Color left)
left - public void setTitleBackgroundRight(java.awt.Color right)
right - public javax.swing.Icon getIcon()
public void setIcon(javax.swing.Icon icon)
icon - public java.awt.Container getContentPane()
content Container.
public void setContentPane(java.awt.Container content)
content - The content to setprotected GradientLabel getTitleBarLabel()
public void setTitleBarVisible(boolean visible)
visible - true if title bar is visiblepublic boolean isTitleBarVisible()
public java.awt.Component add(java.awt.Component comp,
                              int index)
add in class java.awt.Container
public void add(java.awt.Component comp,
                java.lang.Object constraints,
                int index)
add in class java.awt.Container
public void add(java.awt.Component comp,
                java.lang.Object constraints)
add in class java.awt.Containerpublic java.awt.Component add(java.awt.Component comp)
add in class java.awt.Container
public java.awt.Component add(java.lang.String name,
                              java.awt.Component comp)
add in class java.awt.Containerpublic void setFont(java.awt.Font font)
setFont in class javax.swing.JComponentpublic void addNotify()
addNotify in class javax.swing.JComponentpublic void remove(java.awt.Component comp)
remove in class java.awt.Container| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||