|
swingx Version 2005-08-19 |
|||||||||
| 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.JXTitledSeparator
public class JXTitledSeparator
A simple horizontal separator that contains a title.

JXTitledSeparator allows you to specify the title via the #setTitle method. The title alignment may be specified by using the #setHorizontalAlignment method, and accepts all the same arguments as the JLabel#setHorizontalAlignment method.
In addition, you may specify an Icon to use with this separator. The icon will appear "leading" the title (on the left in left-to-right languages, on the right in right-to-left languages). To change the position of the title with respect to the icon, call #setHorizontalTextPosition.
The default font and color of the title comes from the LookAndFeel, mimicking the font and color of the TitledBorder
Here are a few example code snippets:
//create a plain separator
JXTitledSeparator sep = new JXTitledSeparator();
sep.setText("Customer Info");
//create a separator with an icon
sep = new JXTitledSeparator();
sep.setText("Customer Info");
sep.setIcon(new ImageIcon("myimage.png"));
//create a separator with an icon to the right of the title,
//center justified
sep = new JXTitledSeparator();
sep.setText("Customer Info");
sep.setIcon(new ImageIcon("myimage.png"));
sep.setHorizontalAlignment(SwingConstants.CENTER);
sep.setHorizontalTextPosition(SwingConstants.TRAILING);
| 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.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| 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 | |
|---|---|
JXTitledSeparator()
Creates a new instance of JXSeparator. |
|
| Method Summary | |
|---|---|
int |
getHorizontalAlignment()
Returns the alignment of the title contents along the X axis. |
int |
getHorizontalTextPosition()
Returns the horizontal position of the title's text, relative to the icon. |
Icon |
getIcon()
Returns the graphic image (glyph, icon) that the JXTitledSeparator displays. |
String |
getTitle()
|
void |
setForeground(Color foreground)
|
void |
setHorizontalAlignment(int alignment)
Sets the alignment of the title along the X axis. |
void |
setHorizontalTextPosition(int position)
Sets the horizontal position of the title's text, relative to the icon. |
void |
setIcon(Icon icon)
Defines the icon this component will display. |
void |
setTitle(String title)
Sets the title for the separator. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JXTitledSeparator()
| Method Detail |
|---|
public void setTitle(String title)
title - the new title. Any string input is acceptablepublic String getTitle()
public void setHorizontalAlignment(int alignment)
alignment - One of the following constants
defined in SwingConstants:
LEFT,
CENTER,
RIGHT,
LEADING (the default) or
TRAILING.SwingConstants,
getHorizontalAlignment()public int getHorizontalAlignment()
SwingConstants:
LEFT,
CENTER,
RIGHT,
LEADING or
TRAILING.setHorizontalAlignment(int),
SwingConstantspublic void setHorizontalTextPosition(int position)
position - One of the following constants
defined in SwingConstants:
LEFT,
CENTER,
RIGHT,
LEADING, or
TRAILING (the default).
IllegalArgumentExceptionpublic int getHorizontalTextPosition()
SwingConstants:
LEFT,
CENTER,
RIGHT,
LEADING or
TRAILING.SwingConstantspublic void setIcon(Icon icon)
The default value of this property is null.
setHorizontalTextPosition(int),
getIcon()public Icon getIcon()
setIcon(javax.swing.Icon)public void setForeground(Color foreground)
setForeground in class JComponent
|
swingx Version 2005-08-19 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||