KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > ui > about > AboutPanel


1 /* ========================================================================
2  * JCommon : a free general purpose class library for the Java(tm) platform
3  * ========================================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jcommon/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * ---------------
28  * AboutPanel.java
29  * ---------------
30  * (C) Copyright 2001-2004, by Object Refinery Limited.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: AboutPanel.java,v 1.5 2006/03/23 19:47:05 taqua Exp $
36  *
37  * Changes (from 26-Oct-2001)
38  * --------------------------
39  * 26-Nov-2001 : Version 1 (DG);
40  * 27-Jun-2002 : Added logo (DG);
41  * 08-Oct-2002 : Fixed errors reported by Checkstyle (DG);
42  *
43  */

44
45 package org.jfree.ui.about;
46
47 import java.awt.BorderLayout JavaDoc;
48 import java.awt.Color JavaDoc;
49 import java.awt.Font JavaDoc;
50 import java.awt.GridLayout JavaDoc;
51 import java.awt.Image JavaDoc;
52
53 import javax.swing.BorderFactory JavaDoc;
54 import javax.swing.JLabel JavaDoc;
55 import javax.swing.JPanel JavaDoc;
56 import javax.swing.SwingConstants JavaDoc;
57
58 import org.jfree.ui.RefineryUtilities;
59
60 /**
61  * A standard panel for displaying information about an application.
62  *
63  * @author David Gilbert
64  */

65 public class AboutPanel extends JPanel JavaDoc {
66
67     /**
68      * Constructs a panel.
69      *
70      * @param application the application name.
71      * @param version the version.
72      * @param copyright the copyright statement.
73      * @param info other info.
74      */

75     public AboutPanel(final String JavaDoc application,
76                       final String JavaDoc version,
77                       final String JavaDoc copyright,
78                       final String JavaDoc info) {
79
80         this(application, version, copyright, info, null);
81
82     }
83
84     /**
85      * Constructs a panel.
86      *
87      * @param application the application name.
88      * @param version the version.
89      * @param copyright the copyright statement.
90      * @param info other info.
91      * @param logo an optional logo.
92      */

93     public AboutPanel(final String JavaDoc application,
94                       final String JavaDoc version,
95                       final String JavaDoc copyright,
96                       final String JavaDoc info,
97                       final Image JavaDoc logo) {
98
99         setLayout(new BorderLayout JavaDoc());
100
101         final JPanel JavaDoc textPanel = new JPanel JavaDoc(new GridLayout JavaDoc(4, 1, 0, 4));
102
103         final JPanel JavaDoc appPanel = new JPanel JavaDoc();
104         final Font JavaDoc f1 = new Font JavaDoc("Dialog", Font.BOLD, 14);
105         final JLabel JavaDoc appLabel = RefineryUtilities.createJLabel(application, f1, Color.black);
106         appLabel.setHorizontalTextPosition(SwingConstants.CENTER);
107         appPanel.add(appLabel);
108
109         final JPanel JavaDoc verPanel = new JPanel JavaDoc();
110         final Font JavaDoc f2 = new Font JavaDoc("Dialog", Font.PLAIN, 12);
111         final JLabel JavaDoc verLabel = RefineryUtilities.createJLabel(version, f2, Color.black);
112         verLabel.setHorizontalTextPosition(SwingConstants.CENTER);
113         verPanel.add(verLabel);
114
115         final JPanel JavaDoc copyrightPanel = new JPanel JavaDoc();
116         final JLabel JavaDoc copyrightLabel = RefineryUtilities.createJLabel(copyright, f2, Color.black);
117         copyrightLabel.setHorizontalTextPosition(SwingConstants.CENTER);
118         copyrightPanel.add(copyrightLabel);
119
120         final JPanel JavaDoc infoPanel = new JPanel JavaDoc();
121         final JLabel JavaDoc infoLabel = RefineryUtilities.createJLabel(info, f2, Color.black);
122         infoLabel.setHorizontalTextPosition(SwingConstants.CENTER);
123         infoPanel.add(infoLabel);
124
125         textPanel.add(appPanel);
126         textPanel.add(verPanel);
127         textPanel.add(copyrightPanel);
128         textPanel.add(infoPanel);
129
130         add(textPanel);
131
132         if (logo != null) {
133             final JPanel JavaDoc imagePanel = new JPanel JavaDoc(new BorderLayout JavaDoc());
134             imagePanel.add(new javax.swing.JLabel JavaDoc(new javax.swing.ImageIcon JavaDoc(logo)));
135             imagePanel.setBorder(BorderFactory.createLineBorder(Color.black));
136             final JPanel JavaDoc imageContainer = new JPanel JavaDoc(new BorderLayout JavaDoc());
137             imageContainer.add(imagePanel, BorderLayout.NORTH);
138             add(imageContainer, BorderLayout.WEST);
139         }
140
141     }
142
143 }
144
Popular Tags