com.jgoodies.uifextras.panel
Class HeaderPanel

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 com.jgoodies.uifextras.panel.HeaderPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class HeaderPanel
extends JPanel

A panel that shows a a bold title, a description and an optional icon in front of a gradient background.

Note: The API of this class is work in progress. Likely the visibility of the protected methods will be reduced to private.

TODO: Describe the constraints for the title and description in this class comment, e.g. pull up the JavaDoc comment from #setDescription.

Version:
$Revision: 1.6 $
Author:
Karsten Lentzsch
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static com.jgoodies.forms.layout.ConstantSize DEFAULT_MINIMUM_HEIGHT
           
static com.jgoodies.forms.layout.ConstantSize DEFAULT_MINIMUM_WIDTH
           
static String PROPERTYNAME_DESCRIPTION
           
static String PROPERTYNAME_ICON
           
static String PROPERTYNAME_TITLE
           
 
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
HeaderPanel(String title, String description)
          Constructs a HeaderPanel with the given title and description that has no icon.
HeaderPanel(String title, String description, Icon icon)
          Constructs a HeaderPanel with the given title, description and icon.
HeaderPanel(String title, String description, Icon icon, com.jgoodies.forms.layout.ConstantSize minimumWidth, com.jgoodies.forms.layout.ConstantSize minimumHeight)
          Constructs a HeaderPanel for the given title, description, icon, and minimum width and minimum height.
HeaderPanel(String title, String description, Icon icon, JComponent backgroundComponent, com.jgoodies.forms.layout.ConstantSize minimumWidth, com.jgoodies.forms.layout.ConstantSize minimumHeight)
          Constructs a HeaderPanel for the given title, description, icon, and minimum width and minimum height.
 
Method Summary
protected  void build()
          Builds this header panel.
protected  JComponent buildBottomComponent()
          Builds and returns the bottom component, a separator by default.
protected  JComponent buildCenterComponent()
          Builds and returns this header's center component.
protected  JComponent createDefaultBackgroundComponent()
           
protected  JTextComponent createDescriptionArea()
          Creates and returns the JTextComponent used for the description.
protected  JLabel createTitleLabel()
          Creates and returns the JLabel used for the title.
 String getDescription()
          Returns the description text.
 Icon getIcon()
          Returns this header's optional icon.
 String getTitle()
          Returns the title text that will be shown in bold.
 void setDescription(String newDescription)
          Sets this header's description text that will be shown as plain text under the bold title.
 void setIcon(Icon icon)
          Sets the optional icon that will be shown on the right hand side.
 void setTitle(String newTitle)
          Sets the title text that will be shown in bold.
 
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, 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, 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, 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

PROPERTYNAME_TITLE

public static final String PROPERTYNAME_TITLE
See Also:
Constant Field Values

PROPERTYNAME_DESCRIPTION

public static final String PROPERTYNAME_DESCRIPTION
See Also:
Constant Field Values

PROPERTYNAME_ICON

public static final String PROPERTYNAME_ICON
See Also:
Constant Field Values

DEFAULT_MINIMUM_WIDTH

public static final com.jgoodies.forms.layout.ConstantSize DEFAULT_MINIMUM_WIDTH

DEFAULT_MINIMUM_HEIGHT

public static final com.jgoodies.forms.layout.ConstantSize DEFAULT_MINIMUM_HEIGHT
Constructor Detail

HeaderPanel

public HeaderPanel(String title,
                   String description)
Constructs a HeaderPanel with the given title and description that has no icon.

Parameters:
title - the short bold title
description - the plain text shown under the title

HeaderPanel

public HeaderPanel(String title,
                   String description,
                   Icon icon)
Constructs a HeaderPanel with the given title, description and icon.

Parameters:
title - the short bold title
description - the plain text shown under the title
icon - the icon shown in the right-hand side

HeaderPanel

public HeaderPanel(String title,
                   String description,
                   Icon icon,
                   com.jgoodies.forms.layout.ConstantSize minimumWidth,
                   com.jgoodies.forms.layout.ConstantSize minimumHeight)
Constructs a HeaderPanel for the given title, description, icon, and minimum width and minimum height.

Parameters:
title - the short bold title
description - the 2-line plain description shown under the title
icon - the icon shown in the right center of the panel
minimumWidth - the lower bound for this header's width
minimumHeight - the lower bound for this header's center height

HeaderPanel

public HeaderPanel(String title,
                   String description,
                   Icon icon,
                   JComponent backgroundComponent,
                   com.jgoodies.forms.layout.ConstantSize minimumWidth,
                   com.jgoodies.forms.layout.ConstantSize minimumHeight)
Constructs a HeaderPanel for the given title, description, icon, and minimum width and minimum height.

Parameters:
title - the short bold title
description - the 2-line plain description shown under the title
icon - the icon shown in the right center of the panel
minimumWidth - the lower bound for this header's width
minimumHeight - the lower bound for this header's center height
Method Detail

getTitle

public String getTitle()
Returns the title text that will be shown in bold.

Returns:
the title text.

setTitle

public void setTitle(String newTitle)
Sets the title text that will be shown in bold.

Parameters:
newTitle - new title shown in bold

getDescription

public String getDescription()
Returns the description text.

Returns:
the description text.

setDescription

public void setDescription(String newDescription)
Sets this header's description text that will be shown as plain text under the bold title. The description must contain line wraps and shall be limited to two lines.

Parameters:
newDescription - the text shown in plain under the title

getIcon

public Icon getIcon()
Returns this header's optional icon.

Returns:
the icon.

setIcon

public void setIcon(Icon icon)
Sets the optional icon that will be shown on the right hand side. In case the icon is an ImageIcon with a width less than 20 pixel, the image used will be scaled to be twice as large as the original.

Parameters:
icon - the icon to be shown on the right-hand side

createTitleLabel

protected JLabel createTitleLabel()
Creates and returns the JLabel used for the title.

Returns:
the JLabel used for the title.

createDescriptionArea

protected JTextComponent createDescriptionArea()
Creates and returns the JTextComponent used for the description.

Returns:
the JTextComponent used for the description.

createDefaultBackgroundComponent

protected JComponent createDefaultBackgroundComponent()

build

protected void build()
Builds this header panel. This default implementation stacks the center and bottom components and honors the minimum width and height.


buildCenterComponent

protected JComponent buildCenterComponent()
Builds and returns this header's center component.

Returns:
this header's center component.

buildBottomComponent

protected JComponent buildBottomComponent()
Builds and returns the bottom component, a separator by default.

Returns:
this header's bottom component


Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.