📄 buttonborderfactory.java
字号:
* Creates a new title border with an empty title specifying the
* border object, using the default text position (sitting on the top
* line) and default justification (leading) and using the default
* font, and text color.
*
* @param border the <code>Border</code> object to add the title to, if
* null the <code>Border</code> is determined by the
* current look and feel.
* @param title a <code>String</code> containing the text of the title
* @return the <code>TitledBorder</code> object
*/
public static TitledBorder createTitledBorder(Border border) {
return new TitledBorder(border);
}
/**
* Adds a title to an existing border, specifying the text of
* the title, using the default positioning (sitting on the top
* line) and default justification (leading) and using the default
* font and text color determined by the current look and feel.
*
* @param border the <code>Border</code> object to add the title to
* @param title a <code>String</code> containing the text of the title
* @return the <code>TitledBorder</code> object
*/
public static TitledBorder createTitledBorder(Border border,
String title) {
return new TitledBorder(border, title);
}
/**
* Adds a title to an existing border, specifying the text of
* the title along with its positioning, using the default
* font and text color determined by the current look and feel.
*
* @param border the <code>Border</code> object to add the title to
* @param title a <code>String</code> containing the text of the title
* @param titleJustification an integer specifying the justification
* of the title -- one of the following:
*<ul>
*<li><code>TitledBorder.LEFT</code>
*<li><code>TitledBorder.CENTER</code>
*<li><code>TitledBorder.RIGHT</code>
*<li><code>TitledBorder.LEADING</code>
*<li><code>TitledBorder.TRAILING<code>
*<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading)
*</ul>
* @param titlePosition an integer specifying the vertical position of
* the text in relation to the border -- one of the following:
*<ul>
*<li><code> TitledBorder.ABOVE_TOP</code>
*<li>TitledBorder.TOP</code> (sitting on the top line)
*<li><code>TitledBorder.BELOW_TOP</code>
*<li><code>TitledBorder.ABOVE_BOTTOM</code>
*<li><code>TitledBorder.BOTTOM</code> (sitting on the bottom line)
*<li><code>TitledBorder.BELOW_BOTTOM</code>
*<li><code>TitledBorder.DEFAULT_POSITION</code> (top)
*</ul>
* @return the <code>TitledBorder</code> object
*/
public static TitledBorder createTitledBorder(Border border,
String title,
int titleJustification,
int titlePosition) {
return new TitledBorder(border, title, titleJustification,
titlePosition);
}
/**
* Adds a title to an existing border, specifying the text of
* the title along with its positioning and font, using the
* default text color determined by the current look and feel.
*
* @param border the <code>Border</code> object to add the title to
* @param title a <code>String</code> containing the text of the title
* @param titleJustification an integer specifying the justification
* of the title -- one of the following:
*<ul>
*<li><code>TitledBorder.LEFT</code>
*<li><code>TitledBorder.CENTER</code>
*<li><code>TitledBorder.RIGHT</code>
*<li><code>TitledBorder.LEADING</code>
*<li><code>TitledBorder.TRAILING<code>
*<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading)
*</ul>
* @param titlePosition an integer specifying the vertical position of
* the text in relation to the border -- one of the following:
*<ul>
*<li><code> TitledBorder.ABOVE_TOP</code>
*<li>TitledBorder.TOP</code> (sitting on the top line)
*<li><code>TitledBorder.BELOW_TOP</code>
*<li><code>TitledBorder.ABOVE_BOTTOM</code>
*<li><code>TitledBorder.BOTTOM</code> (sitting on the bottom line)
*<li><code>TitledBorder.BELOW_BOTTOM</code>
*<li><code>TitledBorder.DEFAULT_POSITION</code> (top)
*</ul>
* @param titleFont a Font object specifying the title font
* @return the TitledBorder object
*/
public static TitledBorder createTitledBorder(Border border,
String title,
int titleJustification,
int titlePosition,
Font titleFont) {
return new TitledBorder(border, title, titleJustification,
titlePosition, titleFont);
}
/**
* Adds a title to an existing border, specifying the text of
* the title along with its positioning, font, and color.
*
* @param border the <code>Border</code> object to add the title to
* @param title a <code>String</code> containing the text of the title
* @param titleJustification an integer specifying the justification
* of the title -- one of the following:
*<ul>
*<li><code>TitledBorder.LEFT</code>
*<li><code>TitledBorder.CENTER</code>
*<li><code>TitledBorder.RIGHT</code>
*<li><code>TitledBorder.LEADING</code>
*<li><code>TitledBorder.TRAILING<code>
*<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading)
*</ul>
* @param titlePosition an integer specifying the vertical position of
* the text in relation to the border -- one of the following:
*<ul>
*<li><code> TitledBorder.ABOVE_TOP</code>
*<li>TitledBorder.TOP</code> (sitting on the top line)
*<li><code>TitledBorder.BELOW_TOP</code>
*<li><code>TitledBorder.ABOVE_BOTTOM</code>
*<li><code>TitledBorder.BOTTOM</code> (sitting on the bottom line)
*<li><code>TitledBorder.BELOW_BOTTOM</code>
*<li><code>TitledBorder.DEFAULT_POSITION</code> (top)
*</ul>
* @param titleFont a <code>Font</code> object specifying the title font
* @param titleColor a <code>Color</code> object specifying the title color
* @return the <code>TitledBorder</code> object
*/
public static TitledBorder createTitledBorder(Border border,
String title,
int titleJustification,
int titlePosition,
Font titleFont,
Color titleColor) {
return new TitledBorder(border, title, titleJustification,
titlePosition, titleFont, titleColor);
}
//// EmptyBorder ///////////////////////////////////////////////////////////
final static Border emptyBorder = new EmptyBorder(0, 0, 0, 0);
/**
* Creates an empty border that takes up no space. (The width
* of the top, bottom, left, and right sides are all zero.)
*
* @return the <code>Border</code> object
*/
public static Border createEmptyBorder() {
return emptyBorder;
}
/**
* Creates an empty border that takes up space but which does
* no drawing, specifying the width of the top, left, bottom, and
* right sides.
*
* @param top an integer specifying the width of the top,
* in pixels
* @param left an integer specifying the width of the left side,
* in pixels
* @param bottom an integer specifying the width of the right side,
* in pixels
* @param right an integer specifying the width of the bottom,
* in pixels
* @return the <code>Border</code> object
*/
public static Border createEmptyBorder(int top, int left,
int bottom, int right) {
return new EmptyBorder(top, left, bottom, right);
}
//// CompoundBorder ////////////////////////////////////////////////////////
/**
* Creates a compound border with a <code>null</code> inside edge and a
* <code>null</code> outside edge.
*
* @return the <code>CompoundBorder</code> object
*/
public static CompoundBorder createCompoundBorder() {
return new CompoundBorder();
}
/**
* Creates a compound border specifying the border objects to use
* for the outside and inside edges.
*
* @param outsideBorder a <code>Border</code> object for the outer
* edge of the compound border
* @param insideBorder a <code>Border</code> object for the inner
* edge of the compound border
* @return the <code>CompoundBorder</code> object
*/
public static CompoundBorder createCompoundBorder(Border outsideBorder,
Border insideBorder) {
return new CompoundBorder(outsideBorder, insideBorder);
}
//// MatteBorder ////////////////////////////////////////////////////////
/**
* Creates a matte-look border using a solid color. (The difference between
* this border and a line border is that you can specify the individual
* border dimensions.)
*
* @param top an integer specifying the width of the top,
* in pixels
* @param left an integer specifying the width of the left side,
* in pixels
* @param bottom an integer specifying the width of the right side,
* in pixels
* @param right an integer specifying the width of the bottom,
* in pixels
* @param color a <code>Color</code> to use for the border
* @return the <code>MatteBorder</code> object
*/
public static MatteBorder createMatteBorder(int top, int left, int bottom, int right,
Color color) {
return new MatteBorder(top, left, bottom, right, color);
}
/**
* Creates a matte-look border that consists of multiple tiles of a
* specified icon. Multiple copies of the icon are placed side-by-side
* to fill up the border area.
* <p>
* Note:<br>
* If the icon doesn't load, the border area is painted gray.
*
* @param top an integer specifying the width of the top,
* in pixels
* @param left an integer specifying the width of the left side,
* in pixels
* @param bottom an integer specifying the width of the right side,
* in pixels
* @param right an integer specifying the width of the bottom,
* in pixels
* @param tileIcon the <code>Icon</code> object used for the border tiles
* @return the <code>MatteBorder</code> object
*/
public static MatteBorder createMatteBorder(int top, int left, int bottom, int right,
Icon tileIcon) {
return new MatteBorder(top, left, bottom, right, tileIcon);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -