KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > antlr > works > debugger > remote > DBRemoteConnectDialog


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

31
32 package org.antlr.works.debugger.remote;
33
34 import com.jgoodies.forms.factories.Borders;
35 import com.jgoodies.forms.factories.FormFactory;
36 import com.jgoodies.forms.layout.*;
37 import org.antlr.xjlib.appkit.frame.XJDialog;
38 import org.antlr.xjlib.foundation.XJSystem;
39 import org.antlr.works.prefs.AWPrefs;
40
41 import javax.swing.*;
42 import java.awt.*;
43
44 public class DBRemoteConnectDialog extends XJDialog {
45
46     public DBRemoteConnectDialog(Container parent) {
47         super(parent, true);
48
49         initComponents();
50         setSize(337, 141);
51
52         if(XJSystem.isMacOS()) {
53             CellConstraints cc = new CellConstraints();
54
55             buttonBar.remove(cancelButton);
56             buttonBar.remove(connectButton);
57             
58             buttonBar.add(cancelButton, cc.xy(2, 1));
59             buttonBar.add(connectButton, cc.xy(4, 1));
60         }
61
62         setDefaultButton(connectButton);
63         setOKButton(connectButton);
64         setCancelButton(cancelButton);
65     }
66
67     public void dialogWillDisplay() {
68         portField.setText(String.valueOf(AWPrefs.getDebugDefaultLocalPort()));
69     }
70
71     public String JavaDoc getAddress() {
72         return addressField.getText();
73     }
74
75     public int getPort() {
76         return Integer.parseInt(portField.getText());
77     }
78
79     private void initComponents() {
80         // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
81
// Generated using JFormDesigner Open Source Project license - ANTLR (www.antlr.org)
82
dialogPane = new JPanel();
83         contentPane = new JPanel();
84         label1 = new JLabel();
85         addressField = new JTextField();
86         label2 = new JLabel();
87         portField = new JTextField();
88         buttonBar = new JPanel();
89         connectButton = new JButton();
90         cancelButton = new JButton();
91         CellConstraints cc = new CellConstraints();
92
93         //======== this ========
94
setTitle("Connect to Remote Parser");
95         setResizable(false);
96         Container contentPane2 = getContentPane();
97         contentPane2.setLayout(new BorderLayout());
98
99         //======== dialogPane ========
100
{
101             dialogPane.setBorder(Borders.DIALOG_BORDER);
102             dialogPane.setLayout(new BorderLayout());
103
104             //======== contentPane ========
105
{
106                 contentPane.setLayout(new FormLayout(
107                     new ColumnSpec[] {
108                         FormFactory.DEFAULT_COLSPEC,
109                         FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
110                         new ColumnSpec(Sizes.dluX(120))
111                     },
112                     new RowSpec[] {
113                         FormFactory.DEFAULT_ROWSPEC,
114                         FormFactory.LINE_GAP_ROWSPEC,
115                         FormFactory.DEFAULT_ROWSPEC,
116                         FormFactory.LINE_GAP_ROWSPEC,
117                         FormFactory.DEFAULT_ROWSPEC
118                     }));
119
120                 //---- label1 ----
121
label1.setText("Address:");
122                 label1.setHorizontalAlignment(SwingConstants.RIGHT);
123                 contentPane.add(label1, cc.xy(1, 1));
124
125                 //---- addressField ----
126
addressField.setText("localhost");
127                 contentPane.add(addressField, cc.xy(3, 1));
128
129                 //---- label2 ----
130
label2.setText("Port:");
131                 label2.setHorizontalAlignment(SwingConstants.RIGHT);
132                 contentPane.add(label2, cc.xy(1, 3));
133
134                 //---- portField ----
135
portField.setText("2005");
136                 contentPane.add(portField, cc.xy(3, 3));
137             }
138             dialogPane.add(contentPane, BorderLayout.CENTER);
139
140             //======== buttonBar ========
141
{
142                 buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
143                 buttonBar.setLayout(new FormLayout(
144                     new ColumnSpec[] {
145                         FormFactory.GLUE_COLSPEC,
146                         FormFactory.BUTTON_COLSPEC,
147                         FormFactory.RELATED_GAP_COLSPEC,
148                         FormFactory.BUTTON_COLSPEC
149                     },
150                     RowSpec.decodeSpecs("pref")));
151
152                 //---- connectButton ----
153
connectButton.setText("Connect");
154                 buttonBar.add(connectButton, cc.xy(2, 1));
155
156                 //---- cancelButton ----
157
cancelButton.setText("Cancel");
158                 buttonBar.add(cancelButton, cc.xy(4, 1));
159             }
160             dialogPane.add(buttonBar, BorderLayout.SOUTH);
161         }
162         contentPane2.add(dialogPane, BorderLayout.CENTER);
163         pack();
164         // JFormDesigner - End of component initialization //GEN-END:initComponents
165
}
166
167     // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
168
// Generated using JFormDesigner Open Source Project license - ANTLR (www.antlr.org)
169
private JPanel dialogPane;
170     private JPanel contentPane;
171     private JLabel label1;
172     private JTextField addressField;
173     private JLabel label2;
174     private JTextField portField;
175     private JPanel buttonBar;
176     private JButton connectButton;
177     private JButton cancelButton;
178     // JFormDesigner - End of variables declaration //GEN-END:variables
179
}
180
Popular Tags