KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > swing > tabcontrol > plaf > TabPainter


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * TabPainter.java
21  *
22  * Created on December 3, 2003, 4:22 PM
23  */

24
25 package org.netbeans.swing.tabcontrol.plaf;
26
27 import javax.swing.*;
28 import javax.swing.border.Border JavaDoc;
29 import java.awt.*;
30
31 /**
32  * An extention to Border which can provide a non-rectangular interior region
33  * that will contain the tab's content, and actually paint that interior. The
34  * goal of this class is to make it extremely easy to plug in different painting
35  * logic without having to write an entire UI delegate.
36  *
37  * @author Tim Boudreau
38  */

39 public interface TabPainter extends Border JavaDoc {
40
41     /**
42      * Get the polygon representing the tag. Clicks outside this polygon inside
43      * the tab's rectangle will be ignored. This polygon makes up the bounds of
44      * the tab. <p><code>AbstractTabsUI</code> contains generic support for
45      * drawing drag and drop target indications. If want to use it rather than
46      * write your own, you need to specify the polygon returned by this method
47      * with the following point order: The last two points in the point array
48      * of the polygon <strong>must be the bottom left corner, followed by the
49      * bottom right corner</strong>. In other words, start at the upper left
50      * corner when constructing the polygon, and end at the bottom right corner,
51      * using no more than one point for the bottom left and right corners:
52      * <pre>
53      * start here --> /---------
54      * |
55      * finish here --> ----------
56      * </pre>
57      */

58     Polygon getInteriorPolygon(Component renderer);
59
60     /**
61      * Paint the interior (as defined by getInteriorPolygon()) as appropriate
62      * for the tab. Implementations will presumably use different colors to
63      * manage selection, activated state, etc.
64      */

65     void paintInterior(Graphics g, Component renderer);
66
67     /**
68      * Get the close button rectangle for this tab. May contain no implementation
69      * if supportsCloseButton() returns false."
70      *
71      * @param jc The current renderer
72      * @param rect A rectangle that should be configured with the close button
73      * bounds
74      * @param bounds The bounds relative to which the close button rectangle
75      * should be determined
76      */

77     void getCloseButtonRectangle(JComponent jc, Rectangle rect,
78                                  Rectangle bounds);
79
80     /**
81      * Returns true if close button is supported, false otherwise.
82      *
83      * @param renderer The current renderer
84      * @return true if close button is supported, false otherwise
85      */

86     boolean supportsCloseButton(JComponent renderer);
87 }
88
Popular Tags