KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > antlr > works > project > ProjectRunSettingsDialog


1 package org.antlr.works.project;
2
3 import com.jgoodies.forms.factories.Borders;
4 import com.jgoodies.forms.factories.FormFactory;
5 import com.jgoodies.forms.layout.CellConstraints;
6 import com.jgoodies.forms.layout.ColumnSpec;
7 import com.jgoodies.forms.layout.FormLayout;
8 import com.jgoodies.forms.layout.RowSpec;
9 import org.antlr.xjlib.appkit.frame.XJDialog;
10 import org.antlr.xjlib.foundation.XJSystem;
11
12 import javax.swing.*;
13 import java.awt.*;
14 /*
15
16 [The "BSD licence"]
17 Copyright (c) 2005-2006 Jean Bovet
18 All rights reserved.
19
20 Redistribution and use in source and binary forms, with or without
21 modification, are permitted provided that the following conditions
22 are met:
23
24 1. Redistributions of source code must retain the above copyright
25 notice, this list of conditions and the following disclaimer.
26 2. Redistributions in binary form must reproduce the above copyright
27 notice, this list of conditions and the following disclaimer in the
28 documentation and/or other materials provided with the distribution.
29 3. The name of the author may not be used to endorse or promote products
30 derived from this software without specific prior written permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
33 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
34 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
35 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
36 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
37 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
41 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
43 */

44
45 public class ProjectRunSettingsDialog extends XJDialog {
46
47     public ProjectRunSettingsDialog(Container parent) {
48         super(parent, true);
49
50         initComponents();
51         setSize(550, 160);
52
53         if(XJSystem.isMacOS()) {
54             CellConstraints cc = new CellConstraints();
55
56             buttonBar.remove(cancelButton);
57             buttonBar.remove(okButton);
58
59             buttonBar.add(cancelButton, cc.xy(2, 1));
60             buttonBar.add(okButton, cc.xy(4, 1));
61         }
62
63         setDefaultButton(okButton);
64         setOKButton(okButton);
65         setCancelButton(cancelButton);
66     }
67
68     public void dialogWillCloseOK() {
69     }
70
71     public void setRunParametersString(String JavaDoc string) {
72         runArgumentsField.setText(string);
73     }
74
75     public String JavaDoc getRunParametersString() {
76         return runArgumentsField.getText();
77     }
78
79     public void setShowBeforeRunning(boolean flag) {
80         showBeforeRunningButton.setSelected(flag);
81     }
82
83     public boolean isShowBeforeRunning() {
84         return showBeforeRunningButton.isSelected();
85     }
86
87     /** Warning: OK and Cancel button are OS position dependant!
88      *
89      */

90
91     private void initComponents() {
92         // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
93
// Generated using JFormDesigner Open Source Project license - ANTLR (www.antlr.org)
94
dialogPane = new JPanel();
95         contentPane = new JPanel();
96         label1 = new JLabel();
97         runArgumentsField = new JTextField();
98         label2 = new JLabel();
99         showBeforeRunningButton = new JCheckBox();
100         buttonBar = new JPanel();
101         okButton = new JButton();
102         cancelButton = new JButton();
103         CellConstraints cc = new CellConstraints();
104
105         //======== this ========
106
setTitle("Run Settings");
107         Container contentPane2 = getContentPane();
108         contentPane2.setLayout(new BorderLayout());
109
110         //======== dialogPane ========
111
{
112             dialogPane.setBorder(Borders.DIALOG_BORDER);
113             dialogPane.setLayout(new BorderLayout());
114
115             //======== contentPane ========
116
{
117                 contentPane.setLayout(new FormLayout(
118                     new ColumnSpec[] {
119                         FormFactory.DEFAULT_COLSPEC,
120                         FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
121                         new ColumnSpec("max(min;200dlu):grow")
122                     },
123                     new RowSpec[] {
124                         FormFactory.DEFAULT_ROWSPEC,
125                         FormFactory.LINE_GAP_ROWSPEC,
126                         FormFactory.DEFAULT_ROWSPEC,
127                         FormFactory.LINE_GAP_ROWSPEC,
128                         FormFactory.DEFAULT_ROWSPEC,
129                         FormFactory.LINE_GAP_ROWSPEC,
130                         FormFactory.DEFAULT_ROWSPEC
131                     }));
132
133                 //---- label1 ----
134
label1.setText("Run arguments:");
135                 contentPane.add(label1, cc.xy(1, 3));
136                 contentPane.add(runArgumentsField, cc.xy(3, 3));
137
138                 //---- label2 ----
139
label2.setText("(i.e. Test input.txt)");
140                 label2.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
141                 contentPane.add(label2, cc.xy(3, 5));
142
143                 //---- showBeforeRunningButton ----
144
showBeforeRunningButton.setText("Show this dialog before running");
145                 contentPane.add(showBeforeRunningButton, cc.xywh(1, 7, 3, 1));
146             }
147             dialogPane.add(contentPane, BorderLayout.CENTER);
148
149             //======== buttonBar ========
150
{
151                 buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
152                 buttonBar.setLayout(new FormLayout(
153                     new ColumnSpec[] {
154                         FormFactory.GLUE_COLSPEC,
155                         FormFactory.BUTTON_COLSPEC,
156                         FormFactory.RELATED_GAP_COLSPEC,
157                         FormFactory.BUTTON_COLSPEC
158                     },
159                     RowSpec.decodeSpecs("pref")));
160
161                 //---- okButton ----
162
okButton.setText("OK");
163                 buttonBar.add(okButton, cc.xy(2, 1));
164
165                 //---- cancelButton ----
166
cancelButton.setText("Cancel");
167                 buttonBar.add(cancelButton, cc.xy(4, 1));
168             }
169             dialogPane.add(buttonBar, BorderLayout.SOUTH);
170         }
171         contentPane2.add(dialogPane, BorderLayout.CENTER);
172         pack();
173         // JFormDesigner - End of component initialization //GEN-END:initComponents
174
}
175
176     // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
177
// Generated using JFormDesigner Open Source Project license - ANTLR (www.antlr.org)
178
private JPanel dialogPane;
179     private JPanel contentPane;
180     private JLabel label1;
181     private JTextField runArgumentsField;
182     private JLabel label2;
183     private JCheckBox showBeforeRunningButton;
184     private JPanel buttonBar;
185     private JButton okButton;
186     private JButton cancelButton;
187     // JFormDesigner - End of variables declaration //GEN-END:variables
188

189 }
190
Popular Tags