KickJava   Java API By Example, From Geeks To Geeks.

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


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 package org.netbeans.swing.tabcontrol.plaf;
20 import javax.swing.*;
21 import java.awt.event.*;
22 import java.awt.*;
23
24 /** Basic chiclet demo, for use in write-your-own-ui-delegate demo at JavaOne 2004 */
25
26 public class ChicletDemo {
27     public static void main (String JavaDoc[] ignored) {
28         new TestFrame().setVisible(true);
29     }
30
31
32     private static class TestFrame extends JFrame implements WindowListener {
33         private GenericGlowingChiclet thing = new GenericGlowingChiclet();
34
35         public TestFrame() {
36             addWindowListener(this);
37             setBounds(20, 20, 200, 80);
38         }
39
40
41         public void paint(Graphics g) {
42             super.paint(g);
43             ColorUtil.setupAntialiasing(g);
44 // thing.setArcs(20, 20, 20, 20);
45
thing.setArcs(0.5f, 0.5f, 0.5f, 0.5f);
46             thing.setNotch(true, false);
47     Color[] rollover = new Color[]{
48         new Color(222, 222, 227), new Color(220, 238, 255), new Color(190, 247, 255),
49         new Color(205, 205, 205)};
50
51 // thing.setState(thing.STATE_ACTIVE | thing.STATE_SELECTED | thing.STATE_);
52
thing.setColors(rollover[0], rollover[1], rollover[2], rollover[3]);
53             thing.setAllowVertical(true);
54             thing.setBounds(25, 25, getWidth() - 120, getHeight() - 40);
55             thing.draw((Graphics2D) g);
56         }
57
58         public void windowActivated(WindowEvent e) {
59         }
60
61         public void windowClosed(WindowEvent e) {
62         }
63
64         public void windowClosing(WindowEvent e) {
65             System.exit(0);
66         }
67
68         public void windowDeactivated(WindowEvent e) {
69         }
70
71         public void windowDeiconified(WindowEvent e) {
72         }
73
74         public void windowIconified(WindowEvent e) {
75         }
76
77         public void windowOpened(WindowEvent e) {
78         }
79     }}
Popular Tags