KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > ruby > rubyproject > 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.ruby.rubyproject.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     private void initComponents() {//GEN-BEGIN:initComponents
66
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
67
68         jLabel1 = new javax.swing.JLabel JavaDoc();
69         jScrollPane1 = new javax.swing.JScrollPane 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         getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(MainClassWarning.class).getString("AD_MainClassWarning"));
75         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, this.message);
76         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
77         gridBagConstraints.gridx = 0;
78         gridBagConstraints.gridy = 0;
79         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
80         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
81         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
82         gridBagConstraints.weightx = 1.0;
83         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 6, 12);
84         add(jLabel1, gridBagConstraints);
85
86         jScrollPane1.setBorder(null);
87         jScrollPane1.setViewportView(jPanel1);
88
89         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
90         gridBagConstraints.gridx = 1;
91         gridBagConstraints.gridy = 1;
92         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
93         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
94         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
95         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
96         gridBagConstraints.weightx = 1.0;
97         gridBagConstraints.weighty = 1.0;
98         add(jScrollPane1, gridBagConstraints);
99
100     }//GEN-END:initComponents
101

102
103     // Variables declaration - do not modify//GEN-BEGIN:variables
104
private javax.swing.JLabel JavaDoc jLabel1;
105     private javax.swing.JPanel JavaDoc jPanel1;
106     private javax.swing.JScrollPane JavaDoc jScrollPane1;
107     // End of variables declaration//GEN-END:variables
108

109
110 }
111
Popular Tags