JIDE 3.5.15

com.jidesoft.dialog
Class BannerPanel

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.jidesoft.dialog.BannerPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class BannerPanel
extends JPanel

BannerPanel is a panel that can show title, subtitle and icon with title on top, subtitle on the bottom and icon on the left. You can use ImageIcon as the icon but you can also use your own component as the icon component by using setIconComponent(javax.swing.JComponent).

BannerPanel can be placed on top of any dialog or any panel to show some help information or display a product logo.

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
protected  Paint _backgroundPaint
           
protected  Color _endColor
           
protected  boolean _isVertical
           
protected  PropertyChangeListener _propertyListener
           
protected  Color _startColor
           
protected  String _subtitle
          Subtitle or description of the banner panel.
protected  Color _subTitleColor
           
protected  Font _subTitleFont
           
protected  int _subTitleIndent
           
 JPanel _textPanel
           
protected  String _title
          Title of the banner panel.
protected  Color _titleColor
           
protected  Font _titleFont
           
protected  ImageIcon _titleIcon
          Icon for the banner panel.
static String ICON_COMPONENT_PROPERTY
           
static String ICON_PROPERTY
           
static String PROPERTY_SUBTITLE_FONT
           
static String PROPERTY_TITLE_FONT
           
static String PROPERTY_TITLE_ICON_LOCATION
           
static String SUBTITLE_PROPERTY
           
static String TITLE_PROPERTY
           
 
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
BannerPanel()
          Creates an empty BannerPanel.
BannerPanel(String title)
          Creates a BannerPanel with title and subtitle.
BannerPanel(String title, String subtitle)
          Creates a BannerPanel with title and subtitle.
BannerPanel(String title, String subtitle, ImageIcon titleIcon)
          Creates a BannerPanel with title, subtitle and icon.
BannerPanel(String title, String subtitle, JComponent iconComponent)
          Creates a BannerPanel with title, subtitle and component.
 
Method Summary
protected  JComponent createSubtitleLabel()
          Creates the subtitle label.
 Paint getBackgroundPaint()
          Gets the Paint used to paint the background of the BannerPanel.
 Color getEndColor()
           
 JComponent getIconComponent()
          Gets the icon component.
 Color getStartColor()
           
 String getSubtitle()
          Gets the subtitle.
 Color getSubTitleColor()
          Gets the subtitle color.
 Font getSubTitleFont()
          Gets the font of the subtitle.
 int getSubTitleIndent()
          Gets the subtitle indent.
 JComponent getSubtitleLabel()
          Gets the component for the subtitle.
 String getTitle()
          Gets the title.
 Color getTitleColor()
          Gets the title color.
 Font getTitleFont()
          Gets the font of the title.
 ImageIcon getTitleIcon()
          Gets the title icon.
 int getTitleIconLocation()
          Gets the title icon location.
 JComponent getTitleLabel()
          Gets the component for the title.
 boolean isVertical()
           
 void lazyInitialize()
           
protected  void paintComponent(Graphics g)
          Paints the background.
protected  ImageIcon prepareTitleIcon(ImageIcon icon)
          Prepares the title icon.
 void setBackground(Color bg)
           
 void setBackgroundPaint(Paint backgroundPaint)
          Sets the Paint used to paint the background of the BannerPanel.
 void setEndColor(Color endColor)
           
 void setForeground(Color fg)
           
 void setGradientPaint(Color startColor, Color endColor, boolean isVertical)
          This method allows you to use gradient background without using setBackgroundPaint(java.awt.Paint) method.
 void setIconComponent(JComponent iconComponent)
          Sets the icon component.
 void setStartColor(Color startColor)
           
 void setSubtitle(String subtitle)
          Sets the subtitle.
 void setSubTitleColor(Color subTitleColor)
          Sets the subtitle color.
 void setSubTitleFont(Font subTitleFont)
          Sets the font for the subtitle.
 void setSubTitleIndent(int subTitleIndent)
          Sets the subtitle indent.
 void setTitle(String title)
          Sets the title.
 void setTitleColor(Color titleColor)
          Sets the title color.
 void setTitleFont(Font titleFont)
          Sets the font for the title.
 void setTitleIcon(ImageIcon titleIcon)
          Sets the title icon.
 void setTitleIconLocation(int titleIconLocation)
          Sets the title icon location.
 void setVertical(boolean vertical)
           
 
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, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, 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

_title

protected String _title
Title of the banner panel.


_subtitle

protected String _subtitle
Subtitle or description of the banner panel.


_titleIcon

protected ImageIcon _titleIcon
Icon for the banner panel.


TITLE_PROPERTY

public static final String TITLE_PROPERTY
See Also:
Constant Field Values

SUBTITLE_PROPERTY

public static final String SUBTITLE_PROPERTY
See Also:
Constant Field Values

ICON_PROPERTY

public static final String ICON_PROPERTY
See Also:
Constant Field Values

ICON_COMPONENT_PROPERTY

public static final String ICON_COMPONENT_PROPERTY
See Also:
Constant Field Values

PROPERTY_TITLE_FONT

public static final String PROPERTY_TITLE_FONT
See Also:
Constant Field Values

PROPERTY_SUBTITLE_FONT

public static final String PROPERTY_SUBTITLE_FONT
See Also:
Constant Field Values

PROPERTY_TITLE_ICON_LOCATION

public static final String PROPERTY_TITLE_ICON_LOCATION
See Also:
Constant Field Values

_subTitleIndent

protected int _subTitleIndent

_titleFont

protected Font _titleFont

_titleColor

protected Color _titleColor

_subTitleFont

protected Font _subTitleFont

_subTitleColor

protected Color _subTitleColor

_backgroundPaint

protected Paint _backgroundPaint

_propertyListener

protected PropertyChangeListener _propertyListener

_startColor

protected Color _startColor

_endColor

protected Color _endColor

_isVertical

protected boolean _isVertical

_textPanel

public JPanel _textPanel
Constructor Detail

BannerPanel

public BannerPanel()
Creates an empty BannerPanel.


BannerPanel

public BannerPanel(String title)
Creates a BannerPanel with title and subtitle.

Parameters:
title - the title.

BannerPanel

public BannerPanel(String title,
                   String subtitle)
Creates a BannerPanel with title and subtitle.

Parameters:
title - the title.
subtitle - the sub title.

BannerPanel

public BannerPanel(String title,
                   String subtitle,
                   ImageIcon titleIcon)
Creates a BannerPanel with title, subtitle and icon.

Parameters:
title - the title.
subtitle - the sub title.
titleIcon - the icon.

BannerPanel

public BannerPanel(String title,
                   String subtitle,
                   JComponent iconComponent)
Creates a BannerPanel with title, subtitle and component.

Parameters:
title - the title.
subtitle - the sub title.
iconComponent - the icon component. It will appear where the icon is if using constructor BannerPanel(String,String,javax.swing.ImageIcon).
Method Detail

lazyInitialize

public void lazyInitialize()

createSubtitleLabel

protected JComponent createSubtitleLabel()
Creates the subtitle label.

Returns:
a MultilineLabel instance by default.
Since:
3.4.2

prepareTitleIcon

protected ImageIcon prepareTitleIcon(ImageIcon icon)
Prepares the title icon.

Parameters:
icon - the input icon fro setTitleIcon(icon).
Returns:
the image icon after processing. By default it will return the same image icon. Subclass can override it to scale the image or do other processing.

getBackgroundPaint

public Paint getBackgroundPaint()
Gets the Paint used to paint the background of the BannerPanel.

Returns:
the Paint used to paint the background.

setBackgroundPaint

public void setBackgroundPaint(Paint backgroundPaint)
Sets the Paint used to paint the background of the BannerPanel. User can set the paint to a gradient paint to make the BannerPanel looks attractive.

Parameters:
backgroundPaint - the background paint.

setGradientPaint

public void setGradientPaint(Color startColor,
                             Color endColor,
                             boolean isVertical)
This method allows you to use gradient background without using setBackgroundPaint(java.awt.Paint) method. You can use GradientPaint to do the same thing. However if you use this method, it will use fast gradient paint defined in JideSwingUtilities to do the painting.

Parameters:
startColor - start color of the gradient
endColor - end color of the gradient
isVertical - vertical or not

paintComponent

protected void paintComponent(Graphics g)
Paints the background.

Overrides:
paintComponent in class JComponent
Parameters:
g - the Graphics

getTitle

public String getTitle()
Gets the title.

Returns:
the title of the banner panel.

setTitle

public void setTitle(String title)
Sets the title.

Parameters:
title - the new title.

getSubtitle

public String getSubtitle()
Gets the subtitle.

Returns:
the subtitle

setSubtitle

public void setSubtitle(String subtitle)
Sets the subtitle.

Parameters:
subtitle - the new subtitle.

getTitleIcon

public ImageIcon getTitleIcon()
Gets the title icon.

Returns:
the title icon

setTitleIcon

public void setTitleIcon(ImageIcon titleIcon)
Sets the title icon.

Parameters:
titleIcon - the new titleIcon.

getIconComponent

public JComponent getIconComponent()
Gets the icon component. If you use constructor BannerPanel(String,String,javax.swing.ImageIcon), the icon component will be a JLabel with the icon in the 3rd parameter. If you use the constructor BannerPanel(String,String,javax.swing.JComponent), it will return the component as in the 3rd parameter.

Returns:
the icon component

setIconComponent

public void setIconComponent(JComponent iconComponent)
Sets the icon component.

Parameters:
iconComponent - the component that is used as the icon.

getSubTitleFont

public Font getSubTitleFont()
Gets the font of the subtitle.

Returns:
the font of the subtitle

setSubTitleFont

public void setSubTitleFont(Font subTitleFont)
Sets the font for the subtitle.

Parameters:
subTitleFont - the new font for the subtitle.

getTitleFont

public Font getTitleFont()
Gets the font of the title.

Returns:
the font of the title

setTitleFont

public void setTitleFont(Font titleFont)
Sets the font for the title.

Parameters:
titleFont - the new font for the title.

getSubTitleIndent

public int getSubTitleIndent()
Gets the subtitle indent.

Returns:
the subtitle indent.

setSubTitleIndent

public void setSubTitleIndent(int subTitleIndent)
Sets the subtitle indent. Subtitle is always behind the title. The indent will decide how behind. It's in pixels.

Parameters:
subTitleIndent - the new index.

getTitleColor

public Color getTitleColor()
Gets the title color.

Returns:
the color of title.

setTitleColor

public void setTitleColor(Color titleColor)
Sets the title color.

Parameters:
titleColor - the text color for the title.

getSubTitleColor

public Color getSubTitleColor()
Gets the subtitle color.

Returns:
the color of subtitle.

setSubTitleColor

public void setSubTitleColor(Color subTitleColor)
Sets the subtitle color.

Parameters:
subTitleColor - the text color for the subtitle.

setBackground

public void setBackground(Color bg)
Overrides:
setBackground in class JComponent

setForeground

public void setForeground(Color fg)
Overrides:
setForeground in class JComponent

getStartColor

public Color getStartColor()

setStartColor

public void setStartColor(Color startColor)

getEndColor

public Color getEndColor()

setEndColor

public void setEndColor(Color endColor)

isVertical

public boolean isVertical()

setVertical

public void setVertical(boolean vertical)

getTitleIconLocation

public int getTitleIconLocation()
Gets the title icon location. By default, it is SwingConstants.TRAILING.

Returns:
the title icon location.

setTitleIconLocation

public void setTitleIconLocation(int titleIconLocation)
Sets the title icon location. By default the title icon is added a border layout using BorderLayout.AFTER_LINE_ENDS. However you can use this method to decide where to add. Valid values are SwingContants.EAST and SwingContants.WEST as well as SwingContants.LEADING and SwingContants.TRAILING considering the case of both RTL and LTR.

Parameters:
titleIconLocation - the title icon location.

getTitleLabel

public JComponent getTitleLabel()
Gets the component for the title.

Returns:
a JLabel.

getSubtitleLabel

public JComponent getSubtitleLabel()
Gets the component for the subtitle.

Returns:
a MultilineLabel by default

JIDE 3.5.15