KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > j2seproject > ui > customizer > MainClassWarning


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.java.j2seproject.ui.customizer;
21
22 import javax.swing.JPanel JavaDoc;
23 import javax.swing.event.ChangeListener JavaDoc;
24
25 import org.openide.filesystems.FileObject;
26
27 /** Shows a warning that no main class is set and allows choose a main class.
28  *
29  * @author Jiri Rechtacek
30  */

31 public class MainClassWarning extends JPanel JavaDoc {
32
33     private String JavaDoc message;
34     private FileObject[] sourcesRoots;
35
36     /** Creates new form LibrariesChooser */
37     public MainClassWarning (String JavaDoc message, FileObject[] sourcesRoots) {
38         this.sourcesRoots = sourcesRoots;
39         this.message = message;
40         initComponents();
41         // add MainClassChooser
42
}
43     
44     /** Returns the selected main class.
45      *
46      * @return name of class or null if no class with the main method is selected
47      */

48     public String JavaDoc getSelectedMainClass () {
49         return ((MainClassChooser)jPanel1).getSelectedMainClass ();
50     }
51
52     public void addChangeListener (ChangeListener JavaDoc l) {
53         ((MainClassChooser)jPanel1).addChangeListener (l);
54     }
55     
56     public void removeChangeListener (ChangeListener JavaDoc l) {
57         ((MainClassChooser)jPanel1).removeChangeListener (l);
58     }
59     
60     /** This method is called from within the constructor to
61      * initialize the form.
62      * WARNING: Do NOT modify this code. The content of this method is
63      * always regenerated by the Form Editor.
64      */

65     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
66
private void initComponents() {
67         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
68
69         jLabel1 = new javax.swing.JLabel JavaDoc();
70         jPanel1 = new MainClassChooser (sourcesRoots, org.openide.util.NbBundle.getBundle(MainClassWarning.class).getString("CTL_SelectAvaialableMainClasses"));
71
72         setLayout(new java.awt.GridBagLayout JavaDoc());
73
74         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, this.message);
75         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
76         gridBagConstraints.gridx = 0;
77         gridBagConstraints.gridy = 0;
78         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
79         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
80         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
81         gridBagConstraints.weightx = 1.0;
82         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 6, 12);
83         add(jLabel1, gridBagConstraints);
84         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
85         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
86         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
87         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
88         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
89         gridBagConstraints.weightx = 1.0;
90         gridBagConstraints.weighty = 1.0;
91         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 12, 12);
92         add(jPanel1, gridBagConstraints);
93
94         getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(MainClassWarning.class).getString("AD_MainClassWarning")); // NOI18N
95
}// </editor-fold>//GEN-END:initComponents
96

97
98     // Variables declaration - do not modify//GEN-BEGIN:variables
99
private javax.swing.JLabel JavaDoc jLabel1;
100     private javax.swing.JPanel JavaDoc jPanel1;
101     // End of variables declaration//GEN-END:variables
102

103
104 }
105
Popular Tags