KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > j2seplatform > platformdefinition > BrokenPlatformCustomizer


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.modules.java.j2seplatform.platformdefinition;
20
21 import java.awt.Color JavaDoc;
22 import java.awt.Font JavaDoc;
23 import java.io.File JavaDoc;
24 import java.net.URI JavaDoc;
25 import java.net.URL JavaDoc;
26 import java.util.Collection JavaDoc;
27 import javax.swing.JLabel JavaDoc;
28 import javax.swing.text.html.HTMLEditorKit JavaDoc;
29 import javax.swing.text.html.StyleSheet JavaDoc;
30 import org.openide.util.NbBundle;
31
32 /**
33  *
34  * @author tom
35  */

36 public class BrokenPlatformCustomizer extends javax.swing.JPanel JavaDoc {
37
38     private J2SEPlatformImpl platform;
39
40     /** Creates new form BrokenPlatformCustomizer */
41     public BrokenPlatformCustomizer(J2SEPlatformImpl platform) {
42         this.platform = platform;
43         initComponents();
44         postInitComponents ();
45     }
46     
47     /** This method is called from within the constructor to
48      * initialize the form.
49      * WARNING: Do NOT modify this code. The content of this method is
50      * always regenerated by the Form Editor.
51      */

52     private void initComponents() {//GEN-BEGIN:initComponents
53
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
54
55         jLabel1 = new javax.swing.JLabel JavaDoc();
56         platformName = new javax.swing.JTextField JavaDoc();
57         jLabel2 = new javax.swing.JLabel JavaDoc();
58         platformHome = new javax.swing.JTextField JavaDoc();
59         jTextPane1 = new javax.swing.JTextPane JavaDoc();
60
61         setLayout(new java.awt.GridBagLayout JavaDoc());
62
63         jLabel1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seplatform/platformdefinition/Bundle").getString("MNE_PlatformName").charAt(0));
64         jLabel1.setLabelFor(platformName);
65         jLabel1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seplatform/platformdefinition/Bundle").getString("CTL_PlatformName"));
66         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
67         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
68         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 6);
69         add(jLabel1, gridBagConstraints);
70
71         platformName.setEditable(false);
72         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
73         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
74         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
75         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
76         gridBagConstraints.weightx = 1.0;
77         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
78         add(platformName, gridBagConstraints);
79
80         jLabel2.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seplatform/platformdefinition/Bundle").getString("MNE_PlatformHome").charAt(0));
81         jLabel2.setLabelFor(platformHome);
82         jLabel2.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seplatform/platformdefinition/Bundle").getString("CTL_PlatformHome"));
83         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
84         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
85         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 6);
86         add(jLabel2, gridBagConstraints);
87
88         platformHome.setEditable(false);
89         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
90         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
91         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
92         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
93         gridBagConstraints.weightx = 1.0;
94         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 12);
95         add(platformHome, gridBagConstraints);
96
97         jTextPane1.setEditable(false);
98         jTextPane1.setOpaque(false);
99         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
100         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
101         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
102         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
103         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
104         gridBagConstraints.weightx = 1.0;
105         gridBagConstraints.weighty = 1.0;
106         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 12, 12);
107         add(jTextPane1, gridBagConstraints);
108
109     }//GEN-END:initComponents
110

111     
112     private void postInitComponents () {
113         this.platformName.setText (platform.getDisplayName());
114         Collection JavaDoc installFolders = platform.getInstallFolderURLs();
115         if (installFolders.size() > 0) {
116             this.platformHome.setForeground(new Color JavaDoc (164,0,0));
117             this.platformHome.setText (new File JavaDoc(URI.create(((URL JavaDoc)installFolders.iterator().next()).toExternalForm())).getAbsolutePath());
118         }
119         HTMLEditorKit JavaDoc htmlkit = new HTMLEditorKit JavaDoc();
120         StyleSheet JavaDoc css = htmlkit.getStyleSheet();
121         if (css.getStyleSheets() == null) {
122             StyleSheet JavaDoc css2 = new StyleSheet JavaDoc();
123             Font JavaDoc f = jLabel1.getFont();
124             css2.addRule(new StringBuffer JavaDoc("body { font-size: ").append(f.getSize()) // NOI18N
125
.append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
126
css2.addStyleSheet(css);
127             htmlkit.setStyleSheet(css2);
128         }
129         jTextPane1.setEditorKit(htmlkit);
130         jTextPane1.setText(NbBundle.getMessage(BrokenPlatformCustomizer.class,"MSG_BrokenProject"));
131     }
132     
133     // Variables declaration - do not modify//GEN-BEGIN:variables
134
private javax.swing.JLabel JavaDoc jLabel1;
135     private javax.swing.JLabel JavaDoc jLabel2;
136     private javax.swing.JTextPane JavaDoc jTextPane1;
137     private javax.swing.JTextField JavaDoc platformHome;
138     private javax.swing.JTextField JavaDoc platformName;
139     // End of variables declaration//GEN-END:variables
140

141 }
142
Popular Tags