2004-10-22 Michael Koch <konqueror@gmx.de>
[official-gcc.git] / libjava / javax / swing / BorderFactory.java
blob0f5693b9457b00a0d50aa3d64d20380cf6aa69d0
1 /* BorderFactory.java --
2 Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.swing;
41 import java.awt.Color;
42 import java.awt.Font;
44 import javax.swing.border.BevelBorder;
45 import javax.swing.border.Border;
46 import javax.swing.border.CompoundBorder;
47 import javax.swing.border.EmptyBorder;
48 import javax.swing.border.EtchedBorder;
49 import javax.swing.border.LineBorder;
50 import javax.swing.border.MatteBorder;
51 import javax.swing.border.TitledBorder;
53 public class BorderFactory
55 /**
56 * Creates a line border withe the specified color.
58 * @param color A color to use for the line.
60 * @return The Border object
61 */
62 public static Border createLineBorder(Color color)
64 return null;
67 /**
68 * Creates a line border withe the specified color and width. The width
69 * applies to all 4 sides of the border. To specify widths individually for
70 * the top, bottom, left, and right, use
71 * createMatteBorder(int,int,int,int,Color).
73 * @param color A color to use for the line.
74 * @param thickness An int specifying the width in pixels.
76 * @return The Border object
77 */
78 public static Border createLineBorder (Color color, int thickness)
80 return new LineBorder (color, thickness);
83 /**
84 * Created a border with a raised beveled edge, using brighter shades of
85 * the component's current background color for highlighting, and darker
86 * shading for shadows. (In a raised border, highlights are on top and
87 * shadows are underneath.)
89 * @return The Border object
90 */
91 public static Border createRaisedBevelBorder ()
93 return new BevelBorder (BevelBorder.RAISED);
96 /**
97 * Created a border with a lowered beveled edge, using brighter shades of
98 * the component's current background color for highlighting, and darker
99 * shading for shadows. (In a lowered border, shadows are on top and
100 * highlights are underneath.)
102 * @return The Border object
104 public static Border createLoweredBevelBorder ()
106 return new BevelBorder (BevelBorder.LOWERED);
110 * Create a beveled border of the specified type, using brighter shades of
111 * the component's current background color for highlighting, and darker
112 * shading for shadows. (In a lowered border, shadows are on top and
113 * highlights are underneath.).
115 * @param type An int specifying either BevelBorder.LOWERED or
116 * BevelBorder.RAISED
118 * @Return The Border object
120 public static Border createBevelBorder (int type)
122 return new BevelBorder (type);
126 * Create a beveled border of the specified type, using the specified
127 * highlighting and shadowing. The outer edge of the highlighted area uses
128 * a brighter shade of the highlight color. The inner edge of the shadow
129 * area uses a brighter shade of the shadaw color.
131 * @param type An int specifying either BevelBorder.LOWERED or
132 * BevelBorder.RAISED
133 * @param highlight A Color object for highlights
134 * @param shadow A Color object for shadows
136 * @return The Border object
138 public static Border createBevelBorder (int type, Color highlight,
139 Color shadow)
141 return new BevelBorder (type, highlight, shadow);
145 * Create a beveled border of the specified type, using the specified colors
146 * for the inner and outer highlight and shadow areas.
148 * @param type An int specifying either BevelBorder.LOWERED or
149 * BevelBorder.RAISED
150 * @param highlightOuter A Color object for the outer edge of the
151 * highlight area
152 * @param highlightInner A Color object for the inner edge of the
153 * highlight area
154 * @param shadowOuter A Color object for the outer edge of the shadow area
155 * @param shadowInner A Color object for the inner edge of the shadow area
157 * @return The Border object
159 public static Border createBevelBorder (int type, Color highlightOuter,
160 Color highlightInner,
161 Color shadowOuter, Color shadowInner)
163 return new BevelBorder (type, highlightOuter, highlightInner, shadowOuter,
164 shadowInner);
168 * Create a border with an "etched" look using the component's current
169 * background color for highlighting and shading.
171 * @return The Border object
173 public static Border createEtchedBorder ()
175 return new EtchedBorder ();
179 * Create a border with an "etched" look using the component's current
180 * background color for highlighting and shading.
182 * @return The Border object
184 public static Border createEtchedBorder (int etchType)
186 return new EtchedBorder (etchType);
190 * Create a border with an "etched" look using the specified highlighting and
191 * shading colors.
193 * @param highlight A Color object for the border highlights
194 * @param shadow A Color object for the border shadows
196 * @return The Border object
198 public static Border createEtchedBorder (Color highlight, Color shadow)
200 return new EtchedBorder (highlight, shadow);
204 * Create a border with an "etched" look using the specified highlighting and
205 * shading colors.
207 * @param highlight A Color object for the border highlights
208 * @param shadow A Color object for the border shadows
210 * @return The Border object
212 public static Border createEtchedBorder (int etchType, Color highlight,
213 Color shadow)
215 return new EtchedBorder (etchType, highlight, shadow);
219 * Create a new title border specifying the text of the title, using the
220 * default border (etched), using the default text position (sitting on the
221 * top line) and default justification (left) and using the default font and
222 * text color determined by the current look and feel.
224 * @param title A String containing the text of the title
226 * @return The TitledBorder object
228 public static TitledBorder createTitledBorder (String title)
230 return new TitledBorder (title);
234 * Create a new title border with an empty title specifying the border
235 * object, using the default text position (sitting on the top line) and
236 * default justification (left) and using the default font, text color,
237 * and border determined by the current look and feel. (The Motif and Windows
238 * look and feels use an etched border; The Java look and feel use a
239 * gray border.)
241 * @param border The Border object to add the title to
243 * @return The TitledBorder object
245 public static TitledBorder createTitledBorder (Border border)
247 return new TitledBorder (border);
251 * Add a title to an existing border, specifying the text of the title, using
252 * the default positioning (sitting on the top line) and default
253 * justification (left) and using the default font and text color determined
254 * by the current look and feel.
256 * @param order The Border object to add the title to
257 * @param title A String containing the text of the title
259 * @return The TitledBorder object
261 public static TitledBorder createTitledBorder (Border border, String title)
263 return new TitledBorder (border, title);
267 * Add a title to an existing border, specifying the text of the title along
268 * with its positioning, using the default font and text color determined by
269 * the current look and feel.
271 * @param border The Border object to add the title to
272 * @param title A String containing the text of the title
273 * @param titleJustification An int specifying the left/right position of
274 * the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or
275 * TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).
276 * @param titlePosition An int specifying the vertical position of the text
277 * in relation to the border -- one of: TitledBorder.ABOVE_TOP,
278 * TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP,
279 * TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom
280 * line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).
282 * @return The TitledBorder object
284 public static TitledBorder createTitledBorder (Border border, String title,
285 int titleJustification,
286 int titlePosition)
288 return new TitledBorder (border, title, titleJustification, titlePosition);
292 * Add a title to an existing border, specifying the text of the title along
293 * with its positioning and font, using the default text color determined by
294 * the current look and feel.
296 * @param border - the Border object to add the title to
297 * @param title - a String containing the text of the title
298 * @param titleJustification - an int specifying the left/right position of
299 * the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or
300 * TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).
301 * @param titlePosition - an int specifying the vertical position of the
302 * text in relation to the border -- one of: TitledBorder.ABOVE_TOP,
303 * TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP,
304 * TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom
305 * line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).
306 * @param titleFont - a Font object specifying the title font
308 * @return The TitledBorder object
310 public static TitledBorder createTitledBorder (Border border, String title,
311 int titleJustification,
312 int titlePosition,
313 Font titleFont)
315 return new TitledBorder (border, title, titleJustification, titlePosition,
316 titleFont);
320 * Add a title to an existing border, specifying the text of the title along
321 * with its positioning, font, and color.
323 * @param border - the Border object to add the title to
324 * @param title - a String containing the text of the title
325 * @param titleJustification - an int specifying the left/right position of
326 * the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or
327 * TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).
328 * @param titlePosition - an int specifying the vertical position of the text
329 * in relation to the border -- one of: TitledBorder.ABOVE_TOP,
330 * TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP,
331 * TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom
332 * line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).
333 * @param titleFont - a Font object specifying the title font
334 * @param titleColor - a Color object specifying the title color
336 * @return The TitledBorder object
338 public static TitledBorder createTitledBorder (Border border,
339 String title,
340 int titleJustification,
341 int titlePosition,
342 Font titleFont,
343 Color titleColor)
345 return new TitledBorder (border, title, titleJustification, titlePosition,
346 titleFont, titleColor);
350 * Creates an empty border that takes up no space. (The width of the top,
351 * bottom, left, and right sides are all zero.)
353 * @return The Border object
355 public static Border createEmptyBorder ()
357 return new EmptyBorder (0, 0, 0, 0);
361 * Creates an empty border that takes up no space but which does no drawing,
362 * specifying the width of the top, left, bottom, and right sides.
364 * @param top An int specifying the width of the top in pixels
365 * @param left An int specifying the width of the left side in pixels
366 * @param bottom An int specifying the width of the right side in pixels
367 * @param right An int specifying the width of the bottom in pixels
369 * @return The Border object
371 public static Border createEmptyBorder (int top, int left, int bottom,
372 int right)
374 return new EmptyBorder (top, left, bottom, right);
378 * Create a compound border with a null inside edge and a null outside edge.
380 * @return The CompoundBorder object
382 public static CompoundBorder createCompoundBorder ()
384 return new CompoundBorder ();
388 * Create a compound border specifying the border objects to use for the
389 * outside and inside edges.
391 * @param outsideBorder A Border object for the outer edge of the
392 * compound border
393 * @param insideBorder A Border object for the inner edge of the
394 * compound border
396 * @return The CompoundBorder object
398 public static CompoundBorder createCompoundBorder (Border outsideBorder,
399 Border insideBorder)
401 return new CompoundBorder (outsideBorder, insideBorder);
405 * Create a matte-look border using a solid color. (The difference between
406 * this border and a line border is that you can specify the individual
407 * border dimensions.)
409 * @param top An int specifying the width of the top in pixels
410 * @param left An int specifying the width of the left side in pixels
411 * @param bottom An int specifying the width of the right side in pixels
412 * @param right An int specifying the width of the bottom in pixels
413 * @param color A Color to use for the border
415 * @return The MatteBorder object
417 public static MatteBorder createMatteBorder (int top, int left, int bottom,
418 int right, Color color)
420 return new MatteBorder (top, left, bottom, right, color);
424 * Create a matte-look border that consists of multiple tiles of a specified
425 * icon. Multiple copies of the icon are placed side-by-side to fill up the
426 * border area.
428 * Note:
429 * If the icon doesn't load, the border area is painted gray.
431 * @param top An int specifying the width of the top in pixels
432 * @param left An int specifying the width of the left side in pixels
433 * @param bottom An int specifying the width of the right side in pixels
434 * @param right An int specifying the width of the bottom in pixels
435 * @param tileIcon The Icon object used for the border tiles
437 * @return The MatteBorder object
439 public static MatteBorder createMatteBorder (int top, int left, int bottom,
440 int right, Icon tileIcon)
442 return new MatteBorder (top, left, bottom, right, tileIcon);