|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.jidesoft.swing.TitledSeparator
public class TitledSeparator
TitledSeparator
is a component used for separating components on a panel or in a GUI. Each
TitledSeparator
is comprised of a title part and a graphical line. This component is preferred over
TitledBorder
when no full border is desired. To see this component in action, please refer to the
TitledSeparator Demo.
TitledSeparator
can be wholly achieved at construction time. The list below shows the
available constructors for this.
TitledSeparator(String text)
TitledSeparator(String text, int textAlignment)
TitledSeparator(String text, int type, int textAlignment)
TitledSeparator(JComponent component, int textAlignment)
TitledSeparator(JComponent component, int type, int textAlignment)
TitledSeparator(JComponent component, Border border, int alignment)
TitledSeparator(JComponent component, int type, int textAlignment, int barAlignment)
TitledSeparator(JComponent component, Border border, int textAlignment, int barAlignment)
Alternatively, you may use the empty constructor. When this approach is used, the text, border, text alignment
and border alignment will need to be explicitly set. For example:-
TitledSeparator separator = new TitledSeparator();
separator.setLabelComponent(new JLabel("Configured TitledSeparator"));
separator.setTextAlignment(right);
separator.setBarAlignment(center);
separator.setSeparatorBorder(new PartialEtchedBorder(PartialSide.SOUTH));
Please note, that this class should be constructed and modified from the EDT.
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 String |
PROPERTY_BAR_ALIGNMENT
Identifies a change in the bar alignment. |
static String |
PROPERTY_LABEL
Identifies the label has changed. |
static String |
PROPERTY_SEPARATOR_BORDER
Identifies the border has changed. |
static String |
PROPERTY_TEXT_ALIGNMENT
Identifies a change in the text alignment. |
static int |
TYPE_PARTIAL_ETCHED
This value indicates an etched styled line separator. |
static int |
TYPE_PARTIAL_GRADIENT_LINE
This value indicates a gradient line will be used for the separator. |
static int |
TYPE_PARTIAL_LINE
This value indicates a solid line styled separator. |
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 | |
---|---|
TitledSeparator()
Creates the default titled separator. |
|
TitledSeparator(JComponent labelComponent,
Border border,
int textAlignment)
Creates a titled separator with the specified component, border and alignment. |
|
TitledSeparator(JComponent labelComponent,
Border border,
int textAlignment,
int barAlignment)
Creates a titled separator with the specified component, border, alignment and vertical alignment. |
|
TitledSeparator(JComponent labelComponent,
int textAlignment)
Creates a titled separator with the specified component and alignment. |
|
TitledSeparator(JComponent labelComponent,
int type,
int textAlignment)
Creates a titled separator with the specified component, border type and alignment. |
|
TitledSeparator(JComponent labelComponent,
int type,
int textAlignment,
int barAlignment)
Creates a titled separator with the specified component, border type, alignment and vertical alignment. |
|
TitledSeparator(String text)
Creates a default titled separator with the specified text. |
|
TitledSeparator(String text,
int textAlignment)
Creates a titled separator with the specified text and alignment. |
|
TitledSeparator(String text,
int type,
int textAlignment)
Creates a titled separator with the specified text, border type and alignment. |
Method Summary | |
---|---|
int |
getBarAlignment()
Returns the bars vertical alignment. |
JComponent |
getLabelComponent()
Returns the label part of this Titled Separator. |
Border |
getSeparatorBorder()
Returns the border type. |
int |
getTextAlignment()
Returns the texts horizontal alignment. |
void |
setBarAlignment(int barAlignment)
Sets the bars vertical alignment. |
void |
setLabelComponent(JComponent labelComponent)
Sets the labelComponent part of this Titled Separator. |
void |
setSeparatorBorder(Border border)
Sets the border to be used as the graphical line region of this Titled Separator. |
void |
setTextAlignment(int textAlignment)
Sets the texts horizontal alignment. |
void |
validateTitledSeparator()
Responsible for configurating this TitledSeparator |
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 |
Field Detail |
---|
public static final int TYPE_PARTIAL_ETCHED
public static final int TYPE_PARTIAL_LINE
public static final int TYPE_PARTIAL_GRADIENT_LINE
public static final String PROPERTY_LABEL
setLabelComponent(javax.swing.JComponent)
,
Constant Field Valuespublic static final String PROPERTY_SEPARATOR_BORDER
setSeparatorBorder(javax.swing.border.Border)
,
Constant Field Valuespublic static final String PROPERTY_BAR_ALIGNMENT
setBarAlignment(int)
,
Constant Field Valuespublic static final String PROPERTY_TEXT_ALIGNMENT
setTextAlignment(int)
,
Constant Field ValuesConstructor Detail |
---|
public TitledSeparator()
public TitledSeparator(String text)
text
- the title of this titled separatorpublic TitledSeparator(String text, int textAlignment)
text
- the title of this titled separatortextAlignment
- Valid values are: SwingConstants.LEFT, SwingConstants.RIGHT, SwingConstants.LEADING or
SwingConstants.TRAILING.public TitledSeparator(String text, int type, int textAlignment)
text
- the title of this titled separatortype
- the style of border used as the separator line. Valid values are:-
TitledSeparator.TYPE_PARTIAL_ETCHED, TitledSeparator.TYPE_PARTIAL_LINE or
TitledSeparator.TYPE_PARTIAL_GRADIENT_LINE.textAlignment
- Valid values are: SwingConstants.LEFT, SwingConstants.RIGHT, SwingConstants.LEADING or
SwingConstants.TRAILING.public TitledSeparator(JComponent labelComponent, int textAlignment)
labelComponent
- the component to be used as the titled part of this separatortextAlignment
- Valid values are: SwingConstants.LEFT, SwingConstants.RIGHT, SwingConstants.LEADING or
SwingConstants.TRAILING.public TitledSeparator(JComponent labelComponent, int type, int textAlignment)
labelComponent
- the component to be used as the titled part of this separatortype
- the style of border used as the separator line. Valid values are:-
TitledSeparator.TYPE_PARTIAL_ETCHED, TitledSeparator.TYPE_PARTIAL_LINE or
TitledSeparator.TYPE_PARTIAL_GRADIENT_LINE.textAlignment
- Valid values are: SwingConstants.LEFT, SwingConstants.RIGHT, SwingConstants.LEADING or
SwingConstants.TRAILING.public TitledSeparator(JComponent labelComponent, Border border, int textAlignment)
labelComponent
- the component to be used as the titled part of this separatorborder
- the border to be used as the separator linetextAlignment
- Valid values are: SwingConstants.LEFT, SwingConstants.RIGHT, SwingConstants.LEADING or
SwingConstants.TRAILING.public TitledSeparator(JComponent labelComponent, int type, int textAlignment, int barAlignment)
TYPE_PARTIAL_LINE
and
TYPE_PARTIAL_LINE
are configured with a 'thickness' of one pixel. If the the border required is not
the default version, please use another constructor: TitledSeparator(component, border, alignment,
verticalAlignment).
labelComponent
- the component to be used as the titled part of this separatortype
- the style of border used as the separator line. Valid values are:-
TitledSeparator.TYPE_PARTIAL_ETCHED, TitledSeparator.TYPE_PARTIAL_LINE or
TitledSeparator.TYPE_PARTIAL_GRADIENT_LINE.textAlignment
- Valid values are: SwingConstants.LEFT, SwingConstants.RIGHT, SwingConstants.LEADING or
SwingConstants.TRAILING.barAlignment
- Valid values are: SwingConstants.TOP, SwingConstants.CENTER or SwingConstants.BOTTOM.public TitledSeparator(JComponent labelComponent, Border border, int textAlignment, int barAlignment)
labelComponent
- the component to be used as the titled part of this separatorborder
- the border to be used as the separator linetextAlignment
- Valid values are: SwingConstants.LEFT, SwingConstants.RIGHT, SwingConstants.LEADING or
SwingConstants.TRAILING.barAlignment
- Valid values are: SwingConstants.TOP, SwingConstants.CENTER or SwingConstants.BOTTOM.Method Detail |
---|
public void setLabelComponent(JComponent labelComponent)
labelComponent
- the component holding the text to display as the title.getLabelComponent()
public JComponent getLabelComponent()
public void setSeparatorBorder(Border border)
border
- Any border of type: com.jidesoft.swing.PartialEtchedBorder, com.jidesoft.swing.PartialLineBorder or
com.jidesoft.swing.PartialGradientLineBorder.getSeparatorBorder()
public Border getSeparatorBorder()
public void setTextAlignment(int textAlignment)
textAlignment
- an int representing the texts horizontal position. Valid values are: SwingConstants.LEFT,
SwingConstants.RIGHT, SwingConstants.LEADING or SwingConstants.TRAILING.getTextAlignment()
public int getTextAlignment()
public void setBarAlignment(int barAlignment)
barAlignment
- Valid values are: SwingConstants.TOP, SwingConstants.CENTER or SwingConstants.BOTTOM.getBarAlignment()
public int getBarAlignment()
public void validateTitledSeparator()
TitledSeparator. This is the method through which all constructors
ultimately feed.
Creates a titled separator with the specified component, border, alignment and vertical alignment. The alignment
determines whether the specified component will lye on the right or left of the separator line. The vertical
alignment refers to the alignment of the separator line -- top, middle or bottom.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |