1
2
3
4
5
6
7
8
9
10 package com.buckosoft.fibs.BuckoFIBS.gui.account;
11
12 import java.awt.GridBagConstraints;
13 import java.awt.GridBagLayout;
14 import java.awt.Insets;
15
16 import javax.swing.JButton;
17 import javax.swing.JDialog;
18 import javax.swing.JFrame;
19 import javax.swing.JLabel;
20 import javax.swing.JPanel;
21
22
23
24
25
26
27
28 public class NewbieDialog extends JDialog {
29 private static final long serialVersionUID = 1L;
30
31
32 public final static int DO_NOTHING = 0;
33 public final static int USE_EXISTING_ID = 1;
34 public final static int CREATE_NEW_ACCOUNT = 2;
35 private int returnValue = -1;
36
37
38 private JPanel jContentPane = null;
39 private JLabel jLabelNewbie = null;
40 private JLabel jLabelFirstTime = null;
41 private JLabel jLabelChoice = null;
42 private JPanel jPanelButtons = null;
43 private JButton jButtonImport = null;
44 private JButton jButtonNew = null;
45 private JButton jButtonCancel = null;
46 private JLabel jLabelCreateNew = null;
47
48
49 private JLabel jLabelUseless = null;
50
51
52
53
54
55 public NewbieDialog(JFrame owner) {
56 super(owner, true);
57 initialize();
58 this.setLocationRelativeTo(owner);
59 }
60
61
62
63
64
65
66 private void initialize() {
67 this.setSize(374, 249);
68 this.setTitle("Newbie");
69 this.setContentPane(getJContentPane());
70 }
71
72
73
74
75
76 public int getReturnValue() {
77 return returnValue;
78 }
79
80
81
82
83
84
85 private JPanel getJContentPane() {
86 if (jContentPane == null) {
87 GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
88 gridBagConstraints12.gridx = 0;
89 gridBagConstraints12.anchor = GridBagConstraints.NORTHWEST;
90 gridBagConstraints12.weighty = 0.0;
91 gridBagConstraints12.ipady = 0;
92 gridBagConstraints12.insets = new Insets(0, 0, 6, 0);
93 gridBagConstraints12.gridy = 2;
94 jLabelUseless = new JLabel();
95 jLabelUseless.setText("This program is only useful as a connector to FIBS.");
96 GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
97 gridBagConstraints11.gridx = 0;
98 gridBagConstraints11.anchor = GridBagConstraints.NORTHWEST;
99 gridBagConstraints11.gridy = 4;
100 jLabelCreateNew = new JLabel();
101 jLabelCreateNew.setText("Or we can create you a new account");
102 GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
103 gridBagConstraints3.gridx = 0;
104 gridBagConstraints3.fill = GridBagConstraints.BOTH;
105 gridBagConstraints3.weighty = 10.0;
106 gridBagConstraints3.gridy = 5;
107 GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
108 gridBagConstraints2.gridx = 0;
109 gridBagConstraints2.weighty = 0.0;
110 gridBagConstraints2.anchor = GridBagConstraints.NORTHWEST;
111 gridBagConstraints2.gridy = 3;
112 jLabelChoice = new JLabel();
113 jLabelChoice.setText("If you have a FIBS account, you can use it");
114 GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
115 gridBagConstraints1.gridx = 0;
116 gridBagConstraints1.anchor = GridBagConstraints.NORTHWEST;
117 gridBagConstraints1.weighty = 0.0;
118 gridBagConstraints1.gridy = 1;
119 jLabelFirstTime = new JLabel();
120 jLabelFirstTime.setText("This appears to be the first time you have run BuckoFIBS");
121 GridBagConstraints gridBagConstraints = new GridBagConstraints();
122 gridBagConstraints.insets = new Insets(0, 0, 0, 0);
123 gridBagConstraints.gridy = 0;
124 gridBagConstraints.ipadx = 0;
125 gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
126 gridBagConstraints.weighty = 1.0;
127 gridBagConstraints.gridx = 0;
128 jLabelNewbie = new JLabel();
129 jLabelNewbie.setText("Hello Newbie!");
130 jContentPane = new JPanel();
131 jContentPane.setLayout(new GridBagLayout());
132 jContentPane.add(jLabelNewbie, gridBagConstraints);
133 jContentPane.add(jLabelFirstTime, gridBagConstraints1);
134 jContentPane.add(jLabelChoice, gridBagConstraints2);
135 jContentPane.add(getJPanelButtons(), gridBagConstraints3);
136 jContentPane.add(jLabelCreateNew, gridBagConstraints11);
137 jContentPane.add(jLabelUseless, gridBagConstraints12);
138 }
139 return jContentPane;
140 }
141
142
143
144
145
146
147 private JPanel getJPanelButtons() {
148 if (jPanelButtons == null) {
149 GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
150 gridBagConstraints6.gridx = 0;
151 gridBagConstraints6.gridwidth = 2;
152 gridBagConstraints6.insets = new Insets(5, 0, 0, 0);
153 gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
154 gridBagConstraints6.gridy = 2;
155 GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
156 gridBagConstraints5.gridx = 0;
157 gridBagConstraints5.insets = new Insets(0, 0, 5, 0);
158 gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
159 gridBagConstraints5.gridy = 0;
160 GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
161 gridBagConstraints4.gridx = 0;
162 gridBagConstraints4.insets = new Insets(0, 0, 5, 0);
163 gridBagConstraints4.gridy = 1;
164 jPanelButtons = new JPanel();
165 jPanelButtons.setLayout(new GridBagLayout());
166 jPanelButtons.add(getJButtonImport(), gridBagConstraints4);
167 jPanelButtons.add(getJButtonNew(), gridBagConstraints5);
168 jPanelButtons.add(getJButtonCancel(), gridBagConstraints6);
169 }
170 return jPanelButtons;
171 }
172
173
174
175
176
177
178 private JButton getJButtonImport() {
179 if (jButtonImport == null) {
180 jButtonImport = new JButton();
181 jButtonImport.setText("Use my existing FIBS account");
182 jButtonImport.addActionListener(new java.awt.event.ActionListener() {
183 public void actionPerformed(java.awt.event.ActionEvent e) {
184 System.out.println("actionPerformed()");
185 returnValue = USE_EXISTING_ID;
186 setVisible(false);
187 }
188 });
189 }
190 return jButtonImport;
191 }
192
193
194
195
196
197
198 private JButton getJButtonNew() {
199 if (jButtonNew == null) {
200 jButtonNew = new JButton();
201 jButtonNew.setText("Create a new FIBS account");
202 jButtonNew.addActionListener(new java.awt.event.ActionListener() {
203 public void actionPerformed(java.awt.event.ActionEvent e) {
204 System.out.println("actionPerformed()");
205 returnValue = CREATE_NEW_ACCOUNT;
206 setVisible(false);
207 }
208 });
209 }
210 return jButtonNew;
211 }
212
213
214
215
216
217
218 private JButton getJButtonCancel() {
219 if (jButtonCancel == null) {
220 jButtonCancel = new JButton();
221 jButtonCancel.setText("Do Nothing");
222 jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
223 public void actionPerformed(java.awt.event.ActionEvent e) {
224 System.out.println("actionPerformed()");
225 returnValue = DO_NOTHING;
226 setVisible(false);
227 }
228 });
229 }
230 return jButtonCancel;
231 }
232
233 }