KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > bluej > 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.bluej;
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  * @author Milos Kleint copied from j2se project type to bluej one
31  */

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

49     public String JavaDoc getSelectedMainClass () {
50         return ((MainClassChooser)jPanel1).getSelectedMainClass ();
51     }
52     
53     public void setSelectedMainClass(String JavaDoc clazz) {
54         ((MainClassChooser)jPanel1).setSelectedMainClass(clazz);
55     }
56     
57     public String JavaDoc getArguments() {
58         return ((MainClassChooser)jPanel1).getArguments();
59     }
60     
61     public void setArguments(String JavaDoc args) {
62         ((MainClassChooser)jPanel1).setArguments(args);
63     }
64
65     public void addChangeListener (ChangeListener JavaDoc l) {
66         ((MainClassChooser)jPanel1).addChangeListener (l);
67     }
68     
69     public void removeChangeListener (ChangeListener JavaDoc l) {
70         ((MainClassChooser)jPanel1).removeChangeListener (l);
71     }
72     
73     /** This method is called from within the constructor to
74      * initialize the form.
75      * WARNING: Do NOT modify this code. The content of this method is
76      * always regenerated by the Form Editor.
77      */

78     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
79
private void initComponents() {
80         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
81
82         jLabel1 = new javax.swing.JLabel JavaDoc();
83         jPanel1 = new MainClassChooser (sourcesRoots, org.openide.util.NbBundle.getBundle(MainClassWarning.class).getString("CTL_SelectAvaialableMainClasses"));
84
85         setLayout(new java.awt.GridBagLayout JavaDoc());
86
87         getAccessibleContext().setAccessibleDescription(null);
88         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, this.message);
89         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
90         gridBagConstraints.gridx = 0;
91         gridBagConstraints.gridy = 0;
92         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
93         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
94         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
95         gridBagConstraints.weightx = 1.0;
96         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 6, 12);
97         add(jLabel1, gridBagConstraints);
98
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 = 0.1;
105         gridBagConstraints.weighty = 0.1;
106         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 12, 12);
107         add(jPanel1, gridBagConstraints);
108
109     }// </editor-fold>//GEN-END:initComponents
110

111
112     // Variables declaration - do not modify//GEN-BEGIN:variables
113
private javax.swing.JLabel JavaDoc jLabel1;
114     private javax.swing.JPanel JavaDoc jPanel1;
115     // End of variables declaration//GEN-END:variables
116

117
118 }
119
Popular Tags