|
||||||||||
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
org.jdesktop.swingx.JXPanel
org.jdesktop.swingx.JXHeader
public class JXHeader
JXHeader is a simple component consisting of a title, a description,
and an icon. An example of such a component can be seen on
Romain Guys ProgX website
JXHeader
is a simple component that is also sufficiently
configurable to be usable. The description area
accepts HTML conforming to version 3.2 of the HTML standard. The icon, title,
and description are all configurable. JXHeader
itself extends
JXPanel
, providing translucency and painting delegates.
If I were to reconstruct the ui shown in the above screenshot, I might
do so like this:
JXHeader header = new JXHeader();
header.setTitle("Timing Framework Spline Editor");
header.setDescription("Drag control points in the display to change the " +
"shape of the spline\n" +
"Click the Copy Code button to generate the corresponding Java code.");
Icon icon = new ImageIcon(getClass().getResource("tools.png"));
header.setIcon(icon);
Note: The HTML support doesn't exist yet. The UI delegate needs to discover whether
the text supplied is HTML or not, and change the content type of the editor pane
being used. The problem is that if "text/html" is always used, the font is wrong.
This same situation will be found in other parts of the code (JXErrorPane, for instance),
so this needs to be dealt with.
BasicHeaderUI uses the following UI defaults:
Nested Class Summary | |
---|---|
static class |
JXHeader.IconPosition
Specifies desired location of the icon relative to the title/description text. |
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.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
uiClassID
JXHeader pluggable UI key HeaderUI |
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 | |
---|---|
JXHeader()
Creates a new instance of JXHeader |
|
JXHeader(String title,
String description)
Creates a new instance of JXHeader. |
|
JXHeader(String title,
String description,
Icon icon)
Creates a new instance of JXHeader. |
Method Summary | |
---|---|
String |
getDescription()
Gets the description. |
Font |
getDescriptionFont()
Gets description font. |
Color |
getDescriptionForeground()
Gets current description foreground color. |
Icon |
getIcon()
Gets the icon. |
JXHeader.IconPosition |
getIconPosition()
Gets current icon position. |
Dimension |
getPreferredSize()
If the preferredSize has been set to a
non-null value just returns it. |
String |
getTitle()
Gets the title. |
Font |
getTitleFont()
Gets title font. |
Color |
getTitleForeground()
Gets current title foreground color. |
HeaderUI |
getUI()
Returns the look and feel (L&F) object that renders this component. |
String |
getUIClassID()
Returns the name of the L&F class that renders this component. |
void |
setDescription(String description)
Sets the description for this header. |
void |
setDescriptionFont(Font font)
Sets font for the description line of header. |
void |
setDescriptionForeground(Color descriptionForeground)
Sets description foreground color. |
void |
setFont(Font font)
Sets new font for both, title and description line of the header. |
void |
setIcon(Icon icon)
Sets the icon to use for the header. |
void |
setIconPosition(JXHeader.IconPosition iconPosition)
Sets new Icon position. |
void |
setTitle(String title)
Sets the title to use. |
void |
setTitleFont(Font font)
Sets new font for title. |
void |
setTitleForeground(Color titleForeground)
Sets title foreground color. |
void |
setUI(HeaderUI ui)
Sets the look and feel (L&F) object that renders this component. |
void |
updateUI()
Notification from the UIManager that the L&F has changed. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, paramString, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String uiClassID
Constructor Detail |
---|
public JXHeader()
public JXHeader(String title, String description)
title
- specifies the title property for this JXHeaderdescription
- specifies the description property for this JXHeaderpublic JXHeader(String title, String description, Icon icon)
title
- specifies the title property for this JXHeaderdescription
- specifies the description property for this JXHeadericon
- specifies the icon property for this JXHeaderMethod Detail |
---|
public HeaderUI getUI()
getUI
in class JPanel
public void setUI(HeaderUI ui)
ui
- the HeaderUI L&F objectUIDefaults.getUI(javax.swing.JComponent)
public String getUIClassID()
getUIClassID
in class JPanel
uiClassID
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
UIManager
that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager
.
updateUI
in class JPanel
JComponent.updateUI()
public void setTitle(String title)
title
- the Title. May be null.public String getTitle()
public void setDescription(String description)
description
- the description. May be null, may be HTML or plain text.public String getDescription()
public void setIcon(Icon icon)
icon
- may be nullpublic Icon getIcon()
public void setFont(Font font)
setFont
in class JComponent
font
- the desired Font
for this componentJComponent.setFont(java.awt.Font)
public void setTitleFont(Font font)
font
- New title font.public Font getTitleFont()
public void setDescriptionFont(Font font)
font
- New description font.public Font getDescriptionFont()
public Color getTitleForeground()
public void setTitleForeground(Color titleForeground)
titleForeground
- the Color to be used to paint title.public Color getDescriptionForeground()
public void setDescriptionForeground(Color descriptionForeground)
descriptionForeground
- the Color to be used to paint description.public JXHeader.IconPosition getIconPosition()
public void setIconPosition(JXHeader.IconPosition iconPosition)
iconPosition
- new desired icon positiongetIconPosition()
public Dimension getPreferredSize()
javax.swing.JComponent
preferredSize
has been set to a
non-null
value just returns it.
If the UI delegate's getPreferredSize
method returns a non null
value then return that;
otherwise defer to the component's layout manager.
getPreferredSize
in class JComponent
preferredSize
propertyJComponent.setPreferredSize(java.awt.Dimension)
,
ComponentUI
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |