📄 borderfactory.java
字号:
* top line) and default justification (left) and using the default font and * text color determined by the current look and feel. * * @param title A String containing the text of the title * * @return The TitledBorder object */ public static TitledBorder createTitledBorder(String title) { return new TitledBorder(title); } /** * Create 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 (left) and using the default font, text color, * and border determined by the current look and feel. (The Motif and Windows * look and feels use an etched border; The Java look and feel use a * gray border.) * * @param border The Border object to add the title to * * @return The TitledBorder object */ public static TitledBorder createTitledBorder(Border border) { return new TitledBorder(border); } /** * Add a title to an existing border, specifying the text of the title, using * the default positioning (sitting on the top line) and default * justification (left) and using the default font and text color determined * by the current look and feel. * * @param border The Border object to add the title to * @param title A String containing the text of the title * * @return The TitledBorder object */ public static TitledBorder createTitledBorder(Border border, String title) { return new TitledBorder(border, title); } /** * Add 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 Border object to add the title to * @param title A String containing the text of the title * @param titleJustification An int specifying the left/right position of * the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or * TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left). * @param titlePosition An int specifying the vertical position of the text * in relation to the border -- one of: TitledBorder.ABOVE_TOP, * TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, * TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom * line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION * (top). * * @return The TitledBorder object */ public static TitledBorder createTitledBorder(Border border, String title, int titleJustification, int titlePosition) { return new TitledBorder(border, title, titleJustification, titlePosition); } /** * Add 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 Border object to add the title to * @param title - a String containing the text of the title * @param titleJustification - an int specifying the left/right position of * the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or * TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left). * @param titlePosition - an int specifying the vertical position of the * text in relation to the border -- one of: TitledBorder.ABOVE_TOP, * TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, * TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom * line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top). * @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); } /** * Add a title to an existing border, specifying the text of the title along * with its positioning, font, and color. * * @param border - the Border object to add the title to * @param title - a String containing the text of the title * @param titleJustification - an int specifying the left/right position of * the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or * TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left). * @param titlePosition - an int specifying the vertical position of the text * in relation to the border -- one of: TitledBorder.ABOVE_TOP, * TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, * TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom * line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top). * @param titleFont - a Font object specifying the title font * @param titleColor - a Color object specifying the title color * * @return The TitledBorder 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); } /** * Creates an empty border that takes up no space. (The width of the top, * bottom, left, and right sides are all zero.) * * @return The Border object */ public static Border createEmptyBorder() { return new EmptyBorder(0, 0, 0, 0); } /** * Creates an empty border that takes up no space but which does no drawing, * specifying the width of the top, left, bottom, and right sides. * * @param top An int specifying the width of the top in pixels * @param left An int specifying the width of the left side in pixels * @param bottom An int specifying the width of the right side in pixels * @param right An int specifying the width of the bottom in pixels * * @return The Border object */ public static Border createEmptyBorder(int top, int left, int bottom, int right) { return new EmptyBorder(top, left, bottom, right); } /** * Create a compound border with a null inside edge and a null outside edge. * * @return The CompoundBorder object */ public static CompoundBorder createCompoundBorder() { return new CompoundBorder(); } /** * Create a compound border specifying the border objects to use for the * outside and inside edges. * * @param outsideBorder A Border object for the outer edge of the * compound border * @param insideBorder A Border object for the inner edge of the * compound border * * @return The CompoundBorder object */ public static CompoundBorder createCompoundBorder(Border outsideBorder, Border insideBorder) { return new CompoundBorder(outsideBorder, insideBorder); } /** * Create 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 int specifying the width of the top in pixels * @param left * An int specifying the width of the left side in pixels * @param bottom * An int specifying the width of the right side in pixels * @param right * An int specifying the width of the bottom in pixels * @param color * A Color to use for the border * @return The MatteBorder object */ public static MatteBorder createMatteBorder(int top, int left, int bottom, int right, Color color) { return new MatteBorder(top, left, bottom, right, color); } /** * Create 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. * * Note: * If the icon doesn't load, the border area is painted gray. * * @param top An int specifying the width of the top in pixels * @param left An int specifying the width of the left side in pixels * @param bottom An int specifying the width of the right side in pixels * @param right An int specifying the width of the bottom in pixels * @param tileIcon The Icon object used for the border tiles * * @return The MatteBorder 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 + -