KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jndi > browser > AboutDialog


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.jndi.browser;
8
9 import java.awt.BorderLayout JavaDoc;
10 import java.awt.Color JavaDoc;
11 import java.awt.Container JavaDoc;
12 import java.awt.GridLayout JavaDoc;
13 import java.util.ResourceBundle JavaDoc;
14
15 import javax.swing.ImageIcon JavaDoc;
16 import javax.swing.JLabel JavaDoc;
17 import javax.swing.JPanel JavaDoc;
18 import javax.swing.SwingConstants JavaDoc;
19 import javax.swing.UIManager JavaDoc;
20
21 import org.ejtools.adwt.service.AboutService;
22
23 /**
24  * Custom AboutService that shows the EJTools logo and some informations about the virtual machine.
25  *
26  * @author letiemble
27  * @created 2 novembre 2001
28  * @version $Revision: 1.2 $
29  */

30 public class AboutDialog implements AboutService
31 {
32    /** The main panel */
33    protected JPanel JavaDoc panel = null;
34    /** Bundle for I18N */
35    private static ResourceBundle JavaDoc resources = ResourceBundle.getBundle("org.ejtools.jndi.browser.Resources");
36
37
38    /** Constructor for the AboutServiceProvider object */
39    public AboutDialog() { }
40
41
42    /**
43     * Implementation of AboutService. Return the main panel to show.
44     *
45     * @return The main panel
46     */

47    public Container JavaDoc getPanel()
48    {
49       // Lazy creation
50
if (this.panel == null)
51       {
52          this.createPanel();
53       }
54       return this.panel;
55    }
56
57
58    /**
59     * Implementation of AboutService. Return the title of the About box.
60     *
61     * @return The String to display as title
62     */

63    public String JavaDoc getTitle()
64    {
65       return resources.getString("about.dialog.title");
66    }
67
68
69     /** Creation of the panel to show */
70     protected void createPanel()
71     {
72         this.panel = new JPanel JavaDoc(new BorderLayout JavaDoc());
73
74         // North part of the panel
75
this.panel.add("North", new JLabel JavaDoc(new ImageIcon JavaDoc(getClass().getResource("/images/logo.png"))));
76
77         // Center part of the panel
78
this.panel.add("Center", new JLabel JavaDoc(" "));
79
80         // South part of the panel
81
JPanel JavaDoc info = new JPanel JavaDoc(new GridLayout JavaDoc(3, 1));
82       
83         JLabel JavaDoc java = new JLabel JavaDoc(
84             resources.getString("about.dialog.text.javaVersion")
85             + " : "
86             + System.getProperty("java.version"), SwingConstants.LEADING);
87         java.setForeground(Color.black);
88         info.add(java);
89       
90         JLabel JavaDoc vm = new JLabel JavaDoc(
91             resources.getString("about.dialog.text.virtualMachine")
92             + " : "
93             + System.getProperty("java.vm.name")
94             + ", "
95             + System.getProperty("java.vm.version"), SwingConstants.LEADING);
96         vm.setForeground(Color.black);
97         info.add(vm);
98       
99         JLabel JavaDoc laf = new JLabel JavaDoc(
100             resources.getString("about.dialog.text.lookAndFeel")
101             + " : "
102             + UIManager.getLookAndFeel().getName(), SwingConstants.LEADING);
103         vm.setForeground(Color.black);
104         info.add(laf);
105         this.panel.add("South", info);
106     }
107 }
108
Popular Tags