KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > core > ui > ProductInformationPanel


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.core.ui;
21
22 import java.awt.Color JavaDoc;
23 import java.awt.Dimension JavaDoc;
24 import java.awt.Font JavaDoc;
25 import java.awt.Graphics JavaDoc;
26 import java.awt.Toolkit JavaDoc;
27 import java.awt.datatransfer.Clipboard JavaDoc;
28 import java.awt.event.FocusEvent JavaDoc;
29 import java.io.File JavaDoc;
30 import java.text.MessageFormat JavaDoc;
31 import java.util.Enumeration JavaDoc;
32 import java.util.HashSet JavaDoc;
33 import java.util.Locale JavaDoc;
34 import java.util.Set JavaDoc;
35 import java.util.StringTokenizer JavaDoc;
36 import javax.swing.Action JavaDoc;
37 import javax.swing.ImageIcon JavaDoc;
38 import javax.swing.JLabel JavaDoc;
39 import javax.swing.JPanel JavaDoc;
40 import javax.swing.UIManager JavaDoc;
41 import org.netbeans.core.actions.CopyProductInfoAction;
42 import org.openide.filesystems.FileUtil;
43 import org.openide.util.Enumerations;
44 import org.openide.util.Lookup;
45 import org.openide.util.NbBundle;
46 import org.openide.util.Utilities;
47 import org.openide.util.datatransfer.ExClipboard;
48
49 public class ProductInformationPanel extends JPanel JavaDoc {
50
51     private static final int FONT_SIZE_PLUS = 5;
52
53     private static final Color JavaDoc COLOR = Color.black;
54
55     /** holds system clipboard */
56     private static Clipboard JavaDoc clipboard;
57     /** holds instance of action to copy product info into clipboard */
58     private static Action JavaDoc copyAction;
59
60     public ProductInformationPanel() {
61         initComponents();
62         
63         initAccessibility();
64         
65         updateLabelFont(productInformationLabel, Font.BOLD, FONT_SIZE_PLUS, COLOR);
66         updateLabelFont(productVersionLabel, Font.BOLD, COLOR);
67         updateLabelFont(operatingSystemLabel, Font.BOLD, COLOR);
68         updateLabelFont(javaLabel, Font.BOLD, COLOR);
69         updateLabelFont(vmLabel, Font.BOLD, COLOR);
70         updateLabelFont(vendorLabel, Font.BOLD, COLOR);
71         updateLabelFont(javaHomeLabel, Font.BOLD, COLOR);
72         updateLabelFont(systemLocaleLabel, Font.BOLD, COLOR);
73         updateLabelFont(homeDirLabel, Font.BOLD, COLOR);
74         updateLabelFont(currentDirLabel, Font.BOLD, COLOR);
75         updateLabelFont(ideInstallLabel, Font.BOLD, COLOR);
76         updateLabelFont(userDirLabel, Font.BOLD, COLOR);
77         updateLabelFont(productVersionValueLabel, COLOR);
78         updateLabelFont(operatingSystemValueLabel, COLOR);
79         updateLabelFont(javaValueLabel, COLOR);
80         updateLabelFont(vmValueLabel, COLOR);
81         updateLabelFont(vendorValueLabel, COLOR);
82         updateLabelFont(javaHomeValueLabel, COLOR);
83         updateLabelFont(systemLocaleValueLabel, COLOR);
84         updateLabelFont(homeDirValueLabel, COLOR);
85         updateLabelFont(currentDirValueLabel, COLOR);
86         updateLabelFont(ideInstallValueField, COLOR);
87         updateLabelFont(userDirValueLabel, COLOR);
88         
89         if (ideInstallValueField.getText().length() == 0) {
90             // Running in JNLP mode. This field is irrelevant.
91
ideInstallLabel.setVisible(false);
92             ideInstallValueField.setVisible(false);
93             // XXX should currentDirValueLabel be hidden too? not much use...
94
}
95     }
96
97     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
98
private void initComponents() {
99         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
100
101         ideImageLabel = new javax.swing.JLabel JavaDoc();
102         productVersionLabel = new javax.swing.JLabel JavaDoc();
103         operatingSystemLabel = new javax.swing.JLabel JavaDoc();
104         javaLabel = new javax.swing.JLabel JavaDoc();
105         vmLabel = new javax.swing.JLabel JavaDoc();
106         vendorLabel = new javax.swing.JLabel JavaDoc();
107         javaHomeLabel = new javax.swing.JLabel JavaDoc();
108         systemLocaleLabel = new javax.swing.JLabel JavaDoc();
109         homeDirLabel = new javax.swing.JLabel JavaDoc();
110         currentDirLabel = new javax.swing.JLabel JavaDoc();
111         ideInstallLabel = new javax.swing.JLabel JavaDoc();
112         userDirLabel = new javax.swing.JLabel JavaDoc();
113         jPanel1 = new javax.swing.JPanel JavaDoc();
114         productInformationLabel = new FocusableLabel();
115         ideInstallValueField = new javax.swing.JTextArea JavaDoc();
116         copyButton = new javax.swing.JButton JavaDoc();
117         productVersionValueLabel = new javax.swing.JTextArea JavaDoc();
118         operatingSystemValueLabel = new javax.swing.JTextArea JavaDoc();
119         javaValueLabel = new javax.swing.JTextArea JavaDoc();
120         vmValueLabel = new javax.swing.JTextArea JavaDoc();
121         vendorValueLabel = new javax.swing.JTextArea JavaDoc();
122         javaHomeValueLabel = new javax.swing.JTextArea JavaDoc();
123         systemLocaleValueLabel = new javax.swing.JTextArea JavaDoc();
124         homeDirValueLabel = new javax.swing.JTextArea JavaDoc();
125         currentDirValueLabel = new javax.swing.JTextArea JavaDoc();
126         userDirValueLabel = new javax.swing.JTextArea JavaDoc();
127
128         setLayout(new java.awt.GridBagLayout JavaDoc());
129
130         ideImageLabel.setIcon(getIcon());
131         ideImageLabel.setLabelFor(productInformationLabel);
132         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
133         gridBagConstraints.gridx = 0;
134         gridBagConstraints.gridy = 0;
135         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
136         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
137         add(ideImageLabel, gridBagConstraints);
138
139         productVersionLabel.setLabelFor(productVersionValueLabel);
140         productVersionLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_ProductVersion")); // NOI18N
141
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
142         gridBagConstraints.gridx = 1;
143         gridBagConstraints.gridy = 1;
144         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
145         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 0, 0);
146         add(productVersionLabel, gridBagConstraints);
147
148         operatingSystemLabel.setLabelFor(operatingSystemValueLabel);
149         operatingSystemLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_OperationgSystem")); // NOI18N
150
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
151         gridBagConstraints.gridx = 1;
152         gridBagConstraints.gridy = 2;
153         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
154         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 0);
155         add(operatingSystemLabel, gridBagConstraints);
156
157         javaLabel.setLabelFor(javaValueLabel);
158         javaLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_Java")); // NOI18N
159
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
160         gridBagConstraints.gridx = 1;
161         gridBagConstraints.gridy = 3;
162         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
163         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 0);
164         add(javaLabel, gridBagConstraints);
165
166         vmLabel.setLabelFor(vmValueLabel);
167         vmLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_VM")); // NOI18N
168
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
169         gridBagConstraints.gridx = 1;
170         gridBagConstraints.gridy = 4;
171         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
172         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 0);
173         add(vmLabel, gridBagConstraints);
174
175         vendorLabel.setLabelFor(vendorValueLabel);
176         vendorLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_Vendor")); // NOI18N
177
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
178         gridBagConstraints.gridx = 1;
179         gridBagConstraints.gridy = 5;
180         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
181         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 0);
182         add(vendorLabel, gridBagConstraints);
183
184         javaHomeLabel.setLabelFor(javaHomeValueLabel);
185         javaHomeLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_JavaHome")); // NOI18N
186
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
187         gridBagConstraints.gridx = 1;
188         gridBagConstraints.gridy = 6;
189         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
190         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 0);
191         add(javaHomeLabel, gridBagConstraints);
192
193         systemLocaleLabel.setLabelFor(systemLocaleValueLabel);
194         systemLocaleLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_SystemLocale")); // NOI18N
195
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
196         gridBagConstraints.gridx = 1;
197         gridBagConstraints.gridy = 7;
198         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
199         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 0);
200         add(systemLocaleLabel, gridBagConstraints);
201
202         homeDirLabel.setLabelFor(homeDirValueLabel);
203         homeDirLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_HomeDir")); // NOI18N
204
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
205         gridBagConstraints.gridx = 1;
206         gridBagConstraints.gridy = 8;
207         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
208         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 0);
209         add(homeDirLabel, gridBagConstraints);
210
211         currentDirLabel.setLabelFor(currentDirValueLabel);
212         currentDirLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_CurrentDir")); // NOI18N
213
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
214         gridBagConstraints.gridx = 1;
215         gridBagConstraints.gridy = 9;
216         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
217         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 0);
218         add(currentDirLabel, gridBagConstraints);
219
220         ideInstallLabel.setLabelFor(ideInstallValueField);
221         ideInstallLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_IDEInstall")); // NOI18N
222
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
223         gridBagConstraints.gridx = 1;
224         gridBagConstraints.gridy = 11;
225         gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
226         gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
227         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
228         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 5, 0);
229         add(ideInstallLabel, gridBagConstraints);
230
231         userDirLabel.setLabelFor(userDirValueLabel);
232         userDirLabel.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, "LBL_UserDir")); // NOI18N
233
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
234         gridBagConstraints.gridx = 1;
235         gridBagConstraints.gridy = 10;
236         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
237         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 0);
238         add(userDirLabel, gridBagConstraints);
239         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
240         gridBagConstraints.gridx = 1;
241         gridBagConstraints.gridy = 15;
242         gridBagConstraints.gridwidth = 2;
243         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
244         gridBagConstraints.weightx = 1.0;
245         gridBagConstraints.weighty = 1.0;
246         add(jPanel1, gridBagConstraints);
247
248         productInformationLabel.setText(getProductInformationTitle ());
249         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
250         gridBagConstraints.gridwidth = 2;
251         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
252         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 11);
253         add(productInformationLabel, gridBagConstraints);
254
255         ideInstallValueField.setEditable(false);
256         ideInstallValueField.setText(getIDEInstallValue ());
257         ideInstallValueField.setOpaque(false);
258         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
259         gridBagConstraints.gridx = 2;
260         gridBagConstraints.gridy = 11;
261         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
262         gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
263         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
264         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 5, 11);
265         add(ideInstallValueField, gridBagConstraints);
266
267         copyButton.setAction(CopyProductInfoAction.findObject(CopyProductInfoAction.class, true));
268         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
269         gridBagConstraints.gridx = 3;
270         gridBagConstraints.gridy = 0;
271         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 12);
272         add(copyButton, gridBagConstraints);
273
274         productVersionValueLabel.setEditable(false);
275         productVersionValueLabel.setText(getProductVersionValue());
276         productVersionValueLabel.setOpaque(false);
277         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
278         gridBagConstraints.gridx = 2;
279         gridBagConstraints.gridy = 1;
280         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
281         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
282         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 0, 11);
283         add(productVersionValueLabel, gridBagConstraints);
284
285         operatingSystemValueLabel.setEditable(false);
286         operatingSystemValueLabel.setText(getOperatingSystemValue());
287         operatingSystemValueLabel.setOpaque(false);
288         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
289         gridBagConstraints.gridx = 2;
290         gridBagConstraints.gridy = 2;
291         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
292         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
293         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 11);
294         add(operatingSystemValueLabel, gridBagConstraints);
295
296         javaValueLabel.setEditable(false);
297         javaValueLabel.setText(getJavaValue());
298         javaValueLabel.setOpaque(false);
299         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
300         gridBagConstraints.gridx = 2;
301         gridBagConstraints.gridy = 3;
302         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
303         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
304         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 11);
305         add(javaValueLabel, gridBagConstraints);
306
307         vmValueLabel.setEditable(false);
308         vmValueLabel.setText(getVMValue());
309         vmValueLabel.setOpaque(false);
310         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
311         gridBagConstraints.gridx = 2;
312         gridBagConstraints.gridy = 4;
313         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
314         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
315         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 11);
316         add(vmValueLabel, gridBagConstraints);
317
318         vendorValueLabel.setEditable(false);
319         vendorValueLabel.setText(getVendorValue());
320         vendorValueLabel.setOpaque(false);
321         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
322         gridBagConstraints.gridx = 2;
323         gridBagConstraints.gridy = 5;
324         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
325         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
326         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 11);
327         add(vendorValueLabel, gridBagConstraints);
328
329         javaHomeValueLabel.setEditable(false);
330         javaHomeValueLabel.setText(getJavaHomeValue());
331         javaHomeValueLabel.setOpaque(false);
332         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
333         gridBagConstraints.gridx = 2;
334         gridBagConstraints.gridy = 6;
335         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
336         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
337         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 11);
338         add(javaHomeValueLabel, gridBagConstraints);
339
340         systemLocaleValueLabel.setEditable(false);
341         systemLocaleValueLabel.setText(getSystemLocaleValue());
342         systemLocaleValueLabel.setOpaque(false);
343         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
344         gridBagConstraints.gridx = 2;
345         gridBagConstraints.gridy = 7;
346         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
347         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
348         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 11);
349         add(systemLocaleValueLabel, gridBagConstraints);
350
351         homeDirValueLabel.setEditable(false);
352         homeDirValueLabel.setText(getHomeDirValue());
353         homeDirValueLabel.setOpaque(false);
354         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
355         gridBagConstraints.gridx = 2;
356         gridBagConstraints.gridy = 8;
357         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
358         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
359         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 11);
360         add(homeDirValueLabel, gridBagConstraints);
361
362         currentDirValueLabel.setEditable(false);
363         currentDirValueLabel.setText(getCurrentDirValue());
364         currentDirValueLabel.setOpaque(false);
365         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
366         gridBagConstraints.gridx = 2;
367         gridBagConstraints.gridy = 9;
368         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
369         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
370         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 11);
371         add(currentDirValueLabel, gridBagConstraints);
372
373         userDirValueLabel.setEditable(false);
374         userDirValueLabel.setText(getUserDirValue());
375         userDirValueLabel.setOpaque(false);
376         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
377         gridBagConstraints.gridx = 2;
378         gridBagConstraints.gridy = 10;
379         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
380         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
381         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 0, 11);
382         add(userDirValueLabel, gridBagConstraints);
383     }// </editor-fold>//GEN-END:initComponents
384

385     // Variables declaration - do not modify//GEN-BEGIN:variables
386
private javax.swing.JButton JavaDoc copyButton;
387     private javax.swing.JLabel JavaDoc currentDirLabel;
388     private javax.swing.JTextArea JavaDoc currentDirValueLabel;
389     private javax.swing.JLabel JavaDoc homeDirLabel;
390     private javax.swing.JTextArea JavaDoc homeDirValueLabel;
391     private javax.swing.JLabel JavaDoc ideImageLabel;
392     private javax.swing.JLabel JavaDoc ideInstallLabel;
393     private javax.swing.JTextArea JavaDoc ideInstallValueField;
394     private javax.swing.JPanel JavaDoc jPanel1;
395     private javax.swing.JLabel JavaDoc javaHomeLabel;
396     private javax.swing.JTextArea JavaDoc javaHomeValueLabel;
397     private javax.swing.JLabel JavaDoc javaLabel;
398     private javax.swing.JTextArea JavaDoc javaValueLabel;
399     private javax.swing.JLabel JavaDoc operatingSystemLabel;
400     private javax.swing.JTextArea JavaDoc operatingSystemValueLabel;
401     private javax.swing.JLabel JavaDoc productInformationLabel;
402     private javax.swing.JLabel JavaDoc productVersionLabel;
403     private javax.swing.JTextArea JavaDoc productVersionValueLabel;
404     private javax.swing.JLabel JavaDoc systemLocaleLabel;
405     private javax.swing.JTextArea JavaDoc systemLocaleValueLabel;
406     private javax.swing.JLabel JavaDoc userDirLabel;
407     private javax.swing.JTextArea JavaDoc userDirValueLabel;
408     private javax.swing.JLabel JavaDoc vendorLabel;
409     private javax.swing.JTextArea JavaDoc vendorValueLabel;
410     private javax.swing.JLabel JavaDoc vmLabel;
411     private javax.swing.JTextArea JavaDoc vmValueLabel;
412     // End of variables declaration//GEN-END:variables
413

414     private void updateLabelFont (javax.swing.JComponent JavaDoc label, Color JavaDoc color) {
415         updateLabelFont(label, 0, 0, color);
416     }
417
418     private void updateLabelFont (javax.swing.JComponent JavaDoc label, int style, Color JavaDoc color) {
419         updateLabelFont(label, style, 0, color);
420     }
421
422     private void updateLabelFont (javax.swing.JComponent JavaDoc label, int style, int plusSize, Color JavaDoc color) {
423         Font JavaDoc font = label.getFont();
424         if(style != 0) {
425             // don't use deriveFont() - see #49973 for details
426
if (Utilities.isMac()) {
427                 font = new Font JavaDoc(label.getFont().getName(), Font.BOLD, label.getFont().getSize());
428             } else {
429                 font = label.getFont().deriveFont(Font.BOLD);
430             }
431             label.setFont(font);
432         }
433         if(plusSize != 0f) {
434             // don't use deriveFont() - see #49973 for details
435
font = new Font JavaDoc(font.getName(), font.getStyle(), font.getSize() + plusSize);
436             label.setFont(font);
437         }
438         if(color != null) {
439             label.setForeground(color);
440         }
441     }
442
443     private ImageIcon JavaDoc getIcon () {
444         return new ImageIcon JavaDoc(Utilities.loadImage("org/netbeans/core/startup/frame48.gif", true));
445     }
446
447     private String JavaDoc getProductInformationTitle () {
448         return NbBundle.getMessage(ProductInformationPanel.class, "LBL_ProductInformation");
449     }
450
451     public static String JavaDoc getProductVersionValue () {
452         return MessageFormat.format(
453             NbBundle.getBundle("org.netbeans.core.startup.Bundle").getString("currentVersion"),
454             new Object JavaDoc[] {System.getProperty("netbeans.buildnumber")});
455     }
456
457     public static String JavaDoc getOperatingSystemValue () {
458         return NbBundle.getMessage(ProductInformationPanel.class, "Format_OperatingSystem_Value",
459             System.getProperty("os.name", "unknown"),
460             System.getProperty("os.version", "unknown"),
461             System.getProperty("os.arch", "unknown"));
462     }
463
464     public static String JavaDoc getJavaValue () {
465         return System.getProperty("java.version", "unknown");
466     }
467
468     public static String JavaDoc getVMValue () {
469         return System.getProperty("java.vm.name", "unknown") + " " + System.getProperty("java.vm.version", "");
470     }
471
472     private String JavaDoc getVendorValue () {
473         return System.getProperty("java.vendor", "unknown");
474     }
475
476     private String JavaDoc getJavaHomeValue () {
477         return System.getProperty("java.home", "unknown");
478     }
479
480     public static String JavaDoc getSystemLocaleValue () {
481         String JavaDoc branding;
482         return Locale.getDefault().toString() + ((branding = NbBundle.getBranding()) == null ? "" : (" (" + branding + ")")); // NOI18N
483
}
484
485     private String JavaDoc getHomeDirValue () {
486         return System.getProperty("user.home", "unknown");
487     }
488
489     private String JavaDoc getCurrentDirValue () {
490         return System.getProperty("user.dir", "unknown");
491     }
492
493     private String JavaDoc getIDEInstallValue () {
494         String JavaDoc nbhome = System.getProperty("netbeans.home");
495         String JavaDoc nbdirs = System.getProperty("netbeans.dirs");
496         
497         Enumeration JavaDoc<Object JavaDoc> more;
498         if (nbdirs != null) {
499             more = new StringTokenizer JavaDoc(nbdirs, File.pathSeparator);
500         } else {
501             more = Enumerations.empty();
502         }
503             
504         Enumeration JavaDoc<Object JavaDoc> all = Enumerations.concat(Enumerations.singleton(nbhome), more);
505         
506         Set JavaDoc<File JavaDoc> files = new HashSet JavaDoc<File JavaDoc>();
507         StringBuilder JavaDoc sb = new StringBuilder JavaDoc ();
508         String JavaDoc prefix = "";
509         while (all.hasMoreElements ()) {
510             String JavaDoc s = (String JavaDoc)all.nextElement ();
511             if (s == null) {
512                 continue;
513             }
514             File JavaDoc f = FileUtil.normalizeFile(new File JavaDoc(s));
515             if (files.add (f)) {
516                 // new file
517
sb.append (prefix);
518                 sb.append(f.getAbsolutePath());
519                 prefix = "\n";
520             }
521         }
522         
523         return sb.toString ();
524     }
525
526     private String JavaDoc getUserDirValue () {
527         return System.getProperty("netbeans.user");
528     }
529
530     public static String JavaDoc getEncodingValue() {
531         return System.getProperty("file.encoding", "unknown");
532     }
533      
534     public static Clipboard JavaDoc getExClipboard() {
535        if (clipboard == null) {
536            clipboard = Lookup.getDefault().lookup(ExClipboard.class);
537            if (clipboard == null) {
538                clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
539            }
540        }
541         return clipboard;
542     }
543
544     /**
545      */

546     static class FocusableLabel extends JLabel JavaDoc {
547     
548         private boolean isFocused = false;
549
550         public FocusableLabel(){
551             addFocusListener(
552             new java.awt.event.FocusListener JavaDoc() {
553                 public void focusGained(FocusEvent JavaDoc event) {
554                     isFocused = true;
555                     repaint();
556                 }
557                 public void focusLost(FocusEvent JavaDoc event) {
558                     isFocused = false;
559                     repaint();
560                 }
561             });
562
563             getAccessibleContext().setAccessibleDescription(getText());
564             getAccessibleContext().setAccessibleName(getText());
565         }
566         
567         public boolean isFocusable() {
568             return (true);
569         }
570         
571         public void paintComponent(Graphics JavaDoc g) {
572             if (ui != null) {
573                 try {
574                     ui.update(g, this);
575                 }
576                 finally {
577                     g.dispose();
578                 }
579             }
580         
581             if (isFocused) {
582                 Dimension JavaDoc size = getSize();
583                 g.setColor(UIManager.getColor("Button.focus")); // NOI18N
584
g.drawRect(0, 0, size.width-1, size.height-1);
585             }
586         }
587         
588     }
589
590     
591    /** Initilizes accessible contexts
592      */

593     private void initAccessibility(){
594         
595         //java.util.ResourceBundle bundle;
596
//bundle = org.openide.util.NbBundle.getBundle(this.getClass());
597

598         productVersionValueLabel.getAccessibleContext().setAccessibleName(productVersionLabel.getText() + " " + productVersionValueLabel.getText());
599         productVersionValueLabel.getAccessibleContext().setAccessibleDescription(productVersionValueLabel.getText());
600         
601         operatingSystemValueLabel.getAccessibleContext().setAccessibleName(operatingSystemLabel.getText() + " " + operatingSystemValueLabel.getText());
602         operatingSystemValueLabel.getAccessibleContext().setAccessibleDescription(operatingSystemValueLabel.getText());
603         
604         javaValueLabel.getAccessibleContext().setAccessibleName(javaLabel.getText() + " " + javaValueLabel.getText());
605         javaValueLabel.getAccessibleContext().setAccessibleDescription(javaValueLabel.getText());
606         
607         vmValueLabel.getAccessibleContext().setAccessibleName(vmLabel.getText() + " " + vmValueLabel.getText());
608         vmValueLabel.getAccessibleContext().setAccessibleDescription(vmValueLabel.getText());
609         
610         vendorValueLabel.getAccessibleContext().setAccessibleName(vendorLabel.getText() + " " + vendorValueLabel.getText());
611         vendorValueLabel.getAccessibleContext().setAccessibleDescription(vendorValueLabel.getText());
612         
613         javaHomeValueLabel.getAccessibleContext().setAccessibleName(javaHomeLabel.getText() + " " + javaHomeValueLabel.getText());
614         javaHomeValueLabel.getAccessibleContext().setAccessibleDescription(javaHomeValueLabel.getText());
615         
616         systemLocaleValueLabel.getAccessibleContext().setAccessibleName(systemLocaleLabel.getText() + " " + systemLocaleValueLabel.getText());
617         systemLocaleValueLabel.getAccessibleContext().setAccessibleDescription(systemLocaleValueLabel.getText());
618         
619         homeDirValueLabel.getAccessibleContext().setAccessibleName(homeDirLabel.getText() + " " + homeDirValueLabel.getText());
620         homeDirValueLabel.getAccessibleContext().setAccessibleDescription(homeDirValueLabel.getText());
621         
622         currentDirValueLabel.getAccessibleContext().setAccessibleName(currentDirLabel.getText() + " " + currentDirValueLabel.getText());
623         currentDirValueLabel.getAccessibleContext().setAccessibleDescription(currentDirValueLabel.getText());
624         
625         ideInstallValueField.getAccessibleContext().setAccessibleName(ideInstallLabel.getText() + " " + ideInstallValueField.getText());
626         ideInstallValueField.getAccessibleContext().setAccessibleDescription(ideInstallValueField.getText());
627         
628         userDirValueLabel.getAccessibleContext().setAccessibleName(userDirLabel.getText() + " " + userDirValueLabel.getText());
629         userDirValueLabel.getAccessibleContext().setAccessibleDescription(userDirValueLabel.getText());
630     }
631 }
632
Popular Tags