KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > welcome > content > Logo


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 package org.netbeans.modules.welcome.content;
21
22 import java.awt.BorderLayout JavaDoc;
23 import java.awt.Cursor JavaDoc;
24 import java.awt.event.MouseEvent JavaDoc;
25 import java.awt.event.MouseListener JavaDoc;
26 import javax.swing.BorderFactory JavaDoc;
27 import javax.swing.Icon JavaDoc;
28 import javax.swing.ImageIcon JavaDoc;
29 import javax.swing.JLabel JavaDoc;
30 import javax.swing.JPanel JavaDoc;
31 import org.openide.util.Utilities;
32
33 /**
34  *
35  * @author S. Aubrecht
36  */

37 public class Logo extends JPanel JavaDoc implements Constants, MouseListener JavaDoc {
38
39     private String JavaDoc url;
40
41     public static Logo createSunLogo() {
42         return new Logo( SUN_LOGO_IMAGE, BundleSupport.getURL( "SunLogo" ) ); // NOI18N
43
}
44
45     public static Logo createJavaLogo() {
46         return new Logo( JAVA_LOGO_IMAGE, BundleSupport.getURL( "JavaLogo" ) ); // NOI18N
47
}
48
49     public static Logo createNbLogo() {
50         return new Logo( NB_LOGO_IMAGE, BundleSupport.getURL( "NetBeansLogo" ) ); // NOI18N
51
}
52
53     /** Creates a new instance of RecentProjects */
54     public Logo( String JavaDoc img, String JavaDoc url ) {
55         super( new BorderLayout JavaDoc() );
56         Icon JavaDoc image = new ImageIcon JavaDoc(Utilities.loadImage(img, true));
57         JLabel JavaDoc label = new JLabel JavaDoc( image );
58         label.setBorder( BorderFactory.createEmptyBorder() );
59         label.setOpaque( false );
60         label.addMouseListener( this );
61         setOpaque( false );
62         add( label, BorderLayout.CENTER );
63         setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
64         this.url = url;
65     }
66
67     public void mouseClicked(MouseEvent JavaDoc e) {
68         Utils.showURL( url );
69     }
70
71     public void mousePressed(MouseEvent JavaDoc e) {
72     }
73
74     public void mouseReleased(MouseEvent JavaDoc e) {
75     }
76
77     public void mouseEntered(MouseEvent JavaDoc e) {
78     }
79
80     public void mouseExited(MouseEvent JavaDoc e) {
81     }
82 }
83
Popular Tags