public class BannerPanel
extends javax.swing.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.javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected java.awt.Paint |
_backgroundPaint |
protected java.awt.Color |
_endColor |
protected boolean |
_isVertical |
protected java.beans.PropertyChangeListener |
_propertyListener |
protected java.awt.Color |
_startColor |
protected java.lang.String |
_subtitle
Subtitle or description of the banner panel.
|
protected java.awt.Color |
_subTitleColor |
protected java.awt.Font |
_subTitleFont |
protected int |
_subTitleIndent |
javax.swing.JPanel |
_textPanel |
protected java.lang.String |
_title
Title of the banner panel.
|
protected java.awt.Color |
_titleColor |
protected java.awt.Font |
_titleFont |
protected javax.swing.ImageIcon |
_titleIcon
Icon for the banner panel.
|
static java.lang.String |
ICON_COMPONENT_PROPERTY |
static java.lang.String |
ICON_PROPERTY |
static java.lang.String |
PROPERTY_SUBTITLE_FONT |
static java.lang.String |
PROPERTY_TITLE_FONT |
static java.lang.String |
PROPERTY_TITLE_ICON_LOCATION |
static java.lang.String |
SUBTITLE_PROPERTY |
static java.lang.String |
TITLE_PROPERTY |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
BannerPanel()
Creates an empty BannerPanel.
|
BannerPanel(java.lang.String title)
Creates a BannerPanel with title and subtitle.
|
BannerPanel(java.lang.String title,
java.lang.String subtitle)
Creates a BannerPanel with title and subtitle.
|
BannerPanel(java.lang.String title,
java.lang.String subtitle,
javax.swing.ImageIcon titleIcon)
Creates a BannerPanel with title, subtitle and icon.
|
BannerPanel(java.lang.String title,
java.lang.String subtitle,
javax.swing.JComponent iconComponent)
Creates a BannerPanel with title, subtitle and component.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Paint |
getBackgroundPaint()
Gets the Paint used to paint the background of the BannerPanel.
|
java.awt.Color |
getEndColor() |
javax.swing.JComponent |
getIconComponent()
Gets the icon component.
|
java.awt.Color |
getStartColor() |
java.lang.String |
getSubtitle()
Gets the subtitle.
|
java.awt.Color |
getSubTitleColor()
Gets the subtitle color.
|
java.awt.Font |
getSubTitleFont()
Gets the font of the subtitle.
|
int |
getSubTitleIndent()
Gets the subtitle indent.
|
javax.swing.JComponent |
getSubtitleLabel()
Gets the component for the subtitle.
|
java.lang.String |
getTitle()
Gets the title.
|
java.awt.Color |
getTitleColor()
Gets the title color.
|
java.awt.Font |
getTitleFont()
Gets the font of the title.
|
javax.swing.ImageIcon |
getTitleIcon()
Gets the title icon.
|
int |
getTitleIconLocation()
Gets the title icon location.
|
javax.swing.JComponent |
getTitleLabel()
Gets the component for the title.
|
boolean |
isVertical() |
void |
lazyInitialize() |
protected void |
paintComponent(java.awt.Graphics g)
Paints the background.
|
protected javax.swing.ImageIcon |
prepareTitleIcon(javax.swing.ImageIcon icon)
Prepares the title icon.
|
void |
setBackground(java.awt.Color bg) |
void |
setBackgroundPaint(java.awt.Paint backgroundPaint)
Sets the Paint used to paint the background of the BannerPanel.
|
void |
setEndColor(java.awt.Color endColor) |
void |
setForeground(java.awt.Color fg) |
void |
setGradientPaint(java.awt.Color startColor,
java.awt.Color endColor,
boolean isVertical)
This method allows you to use gradient background without using
setBackgroundPaint(java.awt.Paint)
method. |
void |
setIconComponent(javax.swing.JComponent iconComponent)
Sets the icon component.
|
void |
setStartColor(java.awt.Color startColor) |
void |
setSubtitle(java.lang.String subtitle)
Sets the subtitle.
|
void |
setSubTitleColor(java.awt.Color subTitleColor)
Sets the subtitle color.
|
void |
setSubTitleFont(java.awt.Font subTitleFont)
Sets the font for the subtitle.
|
void |
setSubTitleIndent(int subTitleIndent)
Sets the subtitle indent.
|
void |
setTitle(java.lang.String title)
Sets the title.
|
void |
setTitleColor(java.awt.Color titleColor)
Sets the title color.
|
void |
setTitleFont(java.awt.Font titleFont)
Sets the font for the title.
|
void |
setTitleIcon(javax.swing.ImageIcon titleIcon)
Sets the title icon.
|
void |
setTitleIconLocation(int titleIconLocation)
Sets the title icon location.
|
void |
setVertical(boolean vertical) |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
protected java.lang.String _title
protected java.lang.String _subtitle
protected javax.swing.ImageIcon _titleIcon
public static final java.lang.String TITLE_PROPERTY
public static final java.lang.String SUBTITLE_PROPERTY
public static final java.lang.String ICON_PROPERTY
public static final java.lang.String ICON_COMPONENT_PROPERTY
public static final java.lang.String PROPERTY_TITLE_FONT
public static final java.lang.String PROPERTY_SUBTITLE_FONT
public static final java.lang.String PROPERTY_TITLE_ICON_LOCATION
protected int _subTitleIndent
protected java.awt.Font _titleFont
protected java.awt.Color _titleColor
protected java.awt.Font _subTitleFont
protected java.awt.Color _subTitleColor
protected java.awt.Paint _backgroundPaint
protected java.beans.PropertyChangeListener _propertyListener
protected java.awt.Color _startColor
protected java.awt.Color _endColor
protected boolean _isVertical
public javax.swing.JPanel _textPanel
public BannerPanel()
public BannerPanel(java.lang.String title)
title
- the title.public BannerPanel(java.lang.String title, java.lang.String subtitle)
title
- the title.subtitle
- the sub title.public BannerPanel(java.lang.String title, java.lang.String subtitle, javax.swing.ImageIcon titleIcon)
title
- the title.subtitle
- the sub title.titleIcon
- the icon.public BannerPanel(java.lang.String title, java.lang.String subtitle, javax.swing.JComponent iconComponent)
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)
.public void lazyInitialize()
protected javax.swing.ImageIcon prepareTitleIcon(javax.swing.ImageIcon icon)
icon
- the input icon fro setTitleIcon(icon).public java.awt.Paint getBackgroundPaint()
public void setBackgroundPaint(java.awt.Paint backgroundPaint)
backgroundPaint
- the background paint.public void setGradientPaint(java.awt.Color startColor, java.awt.Color endColor, boolean isVertical)
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.startColor
- start color of the gradientendColor
- end color of the gradientisVertical
- vertical or notprotected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- the Graphicspublic java.lang.String getTitle()
public void setTitle(java.lang.String title)
title
- the new title.public java.lang.String getSubtitle()
public void setSubtitle(java.lang.String subtitle)
subtitle
- the new subtitle.public javax.swing.ImageIcon getTitleIcon()
public void setTitleIcon(javax.swing.ImageIcon titleIcon)
titleIcon
- the new titleIcon.public javax.swing.JComponent getIconComponent()
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.public void setIconComponent(javax.swing.JComponent iconComponent)
iconComponent
- the component that is used as the icon.public java.awt.Font getSubTitleFont()
public void setSubTitleFont(java.awt.Font subTitleFont)
subTitleFont
- the new font for the subtitle.public java.awt.Font getTitleFont()
public void setTitleFont(java.awt.Font titleFont)
titleFont
- the new font for the title.public int getSubTitleIndent()
public void setSubTitleIndent(int subTitleIndent)
subTitleIndent
- the new index.public java.awt.Color getTitleColor()
public void setTitleColor(java.awt.Color titleColor)
titleColor
- the text color for the title.public java.awt.Color getSubTitleColor()
public void setSubTitleColor(java.awt.Color subTitleColor)
subTitleColor
- the text color for the subtitle.public void setBackground(java.awt.Color bg)
setBackground
in class javax.swing.JComponent
public void setForeground(java.awt.Color fg)
setForeground
in class javax.swing.JComponent
public java.awt.Color getStartColor()
public void setStartColor(java.awt.Color startColor)
public java.awt.Color getEndColor()
public void setEndColor(java.awt.Color endColor)
public boolean isVertical()
public void setVertical(boolean vertical)
public int getTitleIconLocation()
public void setTitleIconLocation(int titleIconLocation)
titleIconLocation
- the title icon location.public javax.swing.JComponent getTitleLabel()
public javax.swing.JComponent getSubtitleLabel()