KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > border > Border


1 /*
2  * @(#)Border.java 1.19 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.swing.border;
8
9 import java.awt.Graphics JavaDoc;
10 import java.awt.Insets JavaDoc;
11 import java.awt.Rectangle JavaDoc;
12 import java.awt.Component JavaDoc;
13
14 /**
15  * Interface describing an object capable of rendering a border
16  * around the edges of a swing component.
17  * For examples of using borders see
18  * <a HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/border.html">How to Use Borders</a>,
19  * a section in <em>The Java Tutorial.</em>
20  * <p>
21  * In the Swing component set, borders supercede Insets as the
22  * mechanism for creating a (decorated or plain) area around the
23  * edge of a component.
24  * <p>
25  * Usage Notes:
26  * <ul>
27  * <li>Use EmptyBorder to create a plain border (this mechanism
28  * replaces its predecessor, <code>setInsets</code>).
29  * <li>Use CompoundBorder to nest multiple border objects, creating
30  * a single, combined border.
31  * <li>Border instances are designed to be shared. Rather than creating
32  * a new border object using one of border classes, use the
33  * BorderFactory methods, which produces a shared instance of the
34  * common border types.
35  * <li>Additional border styles include BevelBorder, SoftBevelBorder,
36  * EtchedBorder, LineBorder, TitledBorder, and MatteBorder.
37  * <li>To create a new border class, subclass AbstractBorder.
38  * </ul>
39  *
40  * @version 1.19 12/19/03
41  * @author David Kloba
42  * @author Amy Fowler
43  * @see javax.swing.BorderFactory
44  * @see EmptyBorder
45  * @see CompoundBorder
46  */

47 public interface Border
48 {
49     /**
50      * Paints the border for the specified component with the specified
51      * position and size.
52      * @param c the component for which this border is being painted
53      * @param g the paint graphics
54      * @param x the x position of the painted border
55      * @param y the y position of the painted border
56      * @param width the width of the painted border
57      * @param height the height of the painted border
58      */

59     void paintBorder(Component JavaDoc c, Graphics JavaDoc g, int x, int y, int width, int height);
60
61     /**
62      * Returns the insets of the border.
63      * @param c the component for which this border insets value applies
64      */

65     Insets JavaDoc getBorderInsets(Component JavaDoc c);
66
67     /**
68      * Returns whether or not the border is opaque. If the border
69      * is opaque, it is responsible for filling in it's own
70      * background when painting.
71      */

72     boolean isBorderOpaque();
73 }
74
Popular Tags