Package com.jidesoft.swing
Class JideTitledBorder
- java.lang.Object
-
- javax.swing.border.AbstractBorder
-
- com.jidesoft.swing.JideTitledBorder
-
- All Implemented Interfaces:
java.io.Serializable,javax.swing.border.Border
public class JideTitledBorder extends javax.swing.border.AbstractBorderThe source code is the same as TitledBorder in JDK 1.4.2 except field TEXT_INSET_H is 0 instead of 5.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intABOVE_BOTTOMPosition the title above the border's bottom line.static intABOVE_TOPPosition the title above the border's top line.static intBELOW_BOTTOMPosition the title below the border's bottom line.static intBELOW_TOPPosition the title below the border's top line.protected javax.swing.border.Borderborderstatic intBOTTOMPosition the title in the middle of the border's bottom line.static intCENTERPosition title text in the center of the border line.static intDEFAULT_JUSTIFICATIONUse the default justification for the title text.static intDEFAULT_POSITIONUse the default vertical orientation for the title text.protected static intEDGE_SPACINGstatic intLEADINGPosition title text at the left side of the border line for left to right orientation, at the right side of the border line for right to left orientation.static intLEFTPosition title text at the left side of the border line.static intRIGHTPosition title text at the right side of the border line.protected static intTEXT_INSET_Hprotected static intTEXT_SPACINGprotected java.lang.Stringtitleprotected java.awt.ColortitleColorprotected java.awt.FonttitleFontprotected inttitleJustificationprotected inttitlePositionstatic intTOPPosition the title in the middle of the border's top line.static intTRAILINGPosition title text at the right side of the border line for left to right orientation, at the left side of the border line for right to left orientation.
-
Constructor Summary
Constructors Constructor Description JideTitledBorder(java.lang.String title)Creates a JideTitledBorder instance.JideTitledBorder(javax.swing.border.Border border)Creates a JideTitledBorder instance with the specified border and an empty title.JideTitledBorder(javax.swing.border.Border border, java.lang.String title)Creates a JideTitledBorder instance with the specified border and title.JideTitledBorder(javax.swing.border.Border border, java.lang.String title, int titleJustification, int titlePosition)Creates a JideTitledBorder instance with the specified border, title, title-justification, and title-position.JideTitledBorder(javax.swing.border.Border border, java.lang.String title, int titleJustification, int titlePosition, java.awt.Font titleFont)Creates a JideTitledBorder instance with the specified border, title, title-justification, title-position, and title-font.JideTitledBorder(javax.swing.border.Border border, java.lang.String title, int titleJustification, int titlePosition, java.awt.Font titleFont, java.awt.Color titleColor)Creates a JideTitledBorder instance with the specified border, title, title-justification, title-position, title-font, and title-color.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBaseline(java.awt.Component c, int width, int height)Returns the baseline.java.awt.Component.BaselineResizeBehaviorgetBaselineResizeBehavior(java.awt.Component c)Returns an enum indicating how the baseline of the border changes as the size changes.javax.swing.border.BordergetBorder()Returns the border of the titled border.java.awt.InsetsgetBorderInsets(java.awt.Component c)This default implementation returns a newInsetsinstance where thetop,left,bottom, andrightfields are set to0.java.awt.InsetsgetBorderInsets(java.awt.Component c, java.awt.Insets insets)Reinitialize the insets parameter with this Border's current Insets.protected java.awt.FontgetFont(java.awt.Component c)java.awt.DimensiongetMinimumSize(java.awt.Component c)Returns the minimum dimensions this border requires in order to fully display the border and title.java.lang.StringgetTitle()Returns the title of the titled border.java.awt.ColorgetTitleColor()Returns the title-color of the titled border.java.awt.FontgetTitleFont()Returns the title-font of the titled border.intgetTitleJustification()Returns the title-justification of the titled border.intgetTitlePosition()Returns the title-position of the titled border.booleanisBorderOpaque()Returns whether or not the border is opaque.voidpaintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)Paints the border for the specified component with the specified position and size.voidsetBorder(javax.swing.border.Border border)Sets the border of the titled border.voidsetTitle(java.lang.String title)Sets the title of the titled border.voidsetTitleColor(java.awt.Color titleColor)Sets the title-color of the titled border.voidsetTitleFont(java.awt.Font titleFont)Sets the title-font of the titled border.voidsetTitleJustification(int titleJustification)Sets the title-justification of the titled border.voidsetTitlePosition(int titlePosition)Sets the title-position of the titled border.
-
-
-
Field Detail
-
title
protected java.lang.String title
-
border
protected javax.swing.border.Border border
-
titlePosition
protected int titlePosition
-
titleJustification
protected int titleJustification
-
titleFont
protected java.awt.Font titleFont
-
titleColor
protected java.awt.Color titleColor
-
DEFAULT_POSITION
public static final int DEFAULT_POSITION
Use the default vertical orientation for the title text.- See Also:
- Constant Field Values
-
ABOVE_TOP
public static final int ABOVE_TOP
Position the title above the border's top line.- See Also:
- Constant Field Values
-
TOP
public static final int TOP
Position the title in the middle of the border's top line.- See Also:
- Constant Field Values
-
BELOW_TOP
public static final int BELOW_TOP
Position the title below the border's top line.- See Also:
- Constant Field Values
-
ABOVE_BOTTOM
public static final int ABOVE_BOTTOM
Position the title above the border's bottom line.- See Also:
- Constant Field Values
-
BOTTOM
public static final int BOTTOM
Position the title in the middle of the border's bottom line.- See Also:
- Constant Field Values
-
BELOW_BOTTOM
public static final int BELOW_BOTTOM
Position the title below the border's bottom line.- See Also:
- Constant Field Values
-
DEFAULT_JUSTIFICATION
public static final int DEFAULT_JUSTIFICATION
Use the default justification for the title text.- See Also:
- Constant Field Values
-
LEFT
public static final int LEFT
Position title text at the left side of the border line.- See Also:
- Constant Field Values
-
CENTER
public static final int CENTER
Position title text in the center of the border line.- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
Position title text at the right side of the border line.- See Also:
- Constant Field Values
-
LEADING
public static final int LEADING
Position title text at the left side of the border line for left to right orientation, at the right side of the border line for right to left orientation.- See Also:
- Constant Field Values
-
TRAILING
public static final int TRAILING
Position title text at the right side of the border line for left to right orientation, at the left side of the border line for right to left orientation.- See Also:
- Constant Field Values
-
EDGE_SPACING
protected static final int EDGE_SPACING
- See Also:
- Constant Field Values
-
TEXT_SPACING
protected static final int TEXT_SPACING
- See Also:
- Constant Field Values
-
TEXT_INSET_H
protected static final int TEXT_INSET_H
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JideTitledBorder
public JideTitledBorder(java.lang.String title)
Creates a JideTitledBorder instance.- Parameters:
title- the title the border should display
-
JideTitledBorder
public JideTitledBorder(javax.swing.border.Border border)
Creates a JideTitledBorder instance with the specified border and an empty title.- Parameters:
border- the border
-
JideTitledBorder
public JideTitledBorder(javax.swing.border.Border border, java.lang.String title)Creates a JideTitledBorder instance with the specified border and title.- Parameters:
border- the bordertitle- the title the border should display
-
JideTitledBorder
public JideTitledBorder(javax.swing.border.Border border, java.lang.String title, int titleJustification, int titlePosition)Creates a JideTitledBorder instance with the specified border, title, title-justification, and title-position.- Parameters:
border- the bordertitle- the title the border should displaytitleJustification- the justification for the titletitlePosition- the position for the title
-
JideTitledBorder
public JideTitledBorder(javax.swing.border.Border border, java.lang.String title, int titleJustification, int titlePosition, java.awt.Font titleFont)Creates a JideTitledBorder instance with the specified border, title, title-justification, title-position, and title-font.- Parameters:
border- the bordertitle- the title the border should displaytitleJustification- the justification for the titletitlePosition- the position for the titletitleFont- the font for rendering the title
-
JideTitledBorder
@ConstructorProperties({"border","title","titleJustification","titlePosition","titleFont","titleColor"}) public JideTitledBorder(javax.swing.border.Border border, java.lang.String title, int titleJustification, int titlePosition, java.awt.Font titleFont, java.awt.Color titleColor)Creates a JideTitledBorder instance with the specified border, title, title-justification, title-position, title-font, and title-color.- Parameters:
border- the bordertitle- the title the border should displaytitleJustification- the justification for the titletitlePosition- the position for the titletitleFont- the font of the titletitleColor- the color of the title
-
-
Method Detail
-
paintBorder
public void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)Paints the border for the specified component with the specified position and size.- Specified by:
paintBorderin interfacejavax.swing.border.Border- Overrides:
paintBorderin classjavax.swing.border.AbstractBorder- Parameters:
c- the component for which this border is being paintedg- the paint graphicsx- the x position of the painted bordery- the y position of the painted borderwidth- the width of the painted borderheight- the height of the painted border
-
getBorderInsets
public java.awt.Insets getBorderInsets(java.awt.Component c)
This default implementation returns a newInsetsinstance where thetop,left,bottom, andrightfields are set to0.- Specified by:
getBorderInsetsin interfacejavax.swing.border.Border- Overrides:
getBorderInsetsin classjavax.swing.border.AbstractBorder- Parameters:
c- the component for which this border insets value applies- Returns:
- the new
Insetsobject initialized to 0
-
getBorderInsets
public java.awt.Insets getBorderInsets(java.awt.Component c, java.awt.Insets insets)Reinitialize the insets parameter with this Border's current Insets.- Overrides:
getBorderInsetsin classjavax.swing.border.AbstractBorder- Parameters:
c- the component for which this border insets value appliesinsets- the object to be reinitialized
-
isBorderOpaque
public boolean isBorderOpaque()
Returns whether or not the border is opaque.- Specified by:
isBorderOpaquein interfacejavax.swing.border.Border- Overrides:
isBorderOpaquein classjavax.swing.border.AbstractBorder
-
getTitle
public java.lang.String getTitle()
Returns the title of the titled border.
-
getBorder
public javax.swing.border.Border getBorder()
Returns the border of the titled border.
-
getTitlePosition
public int getTitlePosition()
Returns the title-position of the titled border.
-
getTitleJustification
public int getTitleJustification()
Returns the title-justification of the titled border.
-
getTitleFont
public java.awt.Font getTitleFont()
Returns the title-font of the titled border.
-
getTitleColor
public java.awt.Color getTitleColor()
Returns the title-color of the titled border.
-
setTitle
public void setTitle(java.lang.String title)
Sets the title of the titled border. param title the title for the border
-
setBorder
public void setBorder(javax.swing.border.Border border)
Sets the border of the titled border.- Parameters:
border- the border
-
setTitlePosition
public void setTitlePosition(int titlePosition)
Sets the title-position of the titled border.- Parameters:
titlePosition- the position for the border
-
setTitleJustification
public void setTitleJustification(int titleJustification)
Sets the title-justification of the titled border.- Parameters:
titleJustification- the justification for the border
-
setTitleFont
public void setTitleFont(java.awt.Font titleFont)
Sets the title-font of the titled border.- Parameters:
titleFont- the font for the border title
-
setTitleColor
public void setTitleColor(java.awt.Color titleColor)
Sets the title-color of the titled border.- Parameters:
titleColor- the color for the border title
-
getMinimumSize
public java.awt.Dimension getMinimumSize(java.awt.Component c)
Returns the minimum dimensions this border requires in order to fully display the border and title.- Parameters:
c- the component where this border will be drawn
-
getBaseline
public int getBaseline(java.awt.Component c, int width, int height)Returns the baseline.- Overrides:
getBaselinein classjavax.swing.border.AbstractBorder- Throws:
java.lang.NullPointerExceptionjava.lang.IllegalArgumentException- Since:
- 1.6
- See Also:
JComponent.getBaseline(int, int)
-
getBaselineResizeBehavior
public java.awt.Component.BaselineResizeBehavior getBaselineResizeBehavior(java.awt.Component c)
Returns an enum indicating how the baseline of the border changes as the size changes.- Overrides:
getBaselineResizeBehaviorin classjavax.swing.border.AbstractBorder- Throws:
java.lang.NullPointerException- Since:
- 1.6
- See Also:
JComponent.getBaseline(int, int)
-
getFont
protected java.awt.Font getFont(java.awt.Component c)
-
-