View Javadoc
1   /******************************************************************************
2    * PreferencesDialog.java - Allow the user to manage his preferences 
3    * $Id$
4    * 
5    * BuckoFIBS - Backgammon by BuckoSoft
6    * Copyright© 2009,2010 - Dick Balaska - BuckoSoft, Corp.
7    * 
8    * $Log$
9    * Revision 1.7  2011/05/13 14:28:35  dick
10   * Add the animation preferences.
11   *
12   * Revision 1.6  2011/05/11 19:15:56  dick
13   * Add AnimateMoves and DEBUGshowAnimatePath.
14   *
15   * Revision 1.5  2010/12/29 07:48:30  dick
16   * Add Dice configuration.
17   *
18   * Revision 1.4  2010/03/03 13:12:21  inim
19   * Replaced (c) sign in comment mangled by CVS default encoding back to UTF-8
20   *
21   * Revision 1.3  2010/03/03 12:19:49  inim
22   * Moved source to UTF8 encoding from CP1252 encoding. To this end all source files' (c) message was updated to "Copyright© 2009,2010 - Dick Balaska - BuckoSoft, Corp.". This replaces the (c) sign to UTF8, and adds the new year 2010.
23   *
24   * Revision 1.2  2010/02/08 09:14:13  dick
25   * Add support for autoGreedyBearoff.  When the game turns to a race, enable greedy bearoffs.
26   *
27   * Revision 1.1  2010/02/04 05:57:53  inim
28   * Mavenized project folder layout
29   *
30   * Revision 1.10  2009/02/14 13:16:26  dick
31   * BuckoFIBS is released under the GNU license.
32   *
33   * Revision 1.9  2009/02/12 06:26:45  dick
34   * Add the audioCues property.
35   *
36   * Revision 1.8  2009/01/28 19:12:45  dick
37   * Move all of the debug message settings to the messages preferences dialog.
38   * Add hoverHelper.
39   *
40   * Revision 1.7  2009/01/18 06:17:18  dick
41   * Get rid of DebugNotReady.  NotReady is a real user attribute.
42   *
43   * Revision 1.6  2009/01/18 04:57:27  dick
44   * The owner is a JFrame.
45   * Add showPointNumbers.
46   *
47   * Revision 1.5  2009/01/09 07:00:21  dick
48   * stdoutNetMessages.
49   *
50   * Revision 1.4  2009/01/04 21:30:53  dick
51   * Add allowMultiplePersonalities
52   *
53   * Revision 1.3  2008/12/14 06:44:13  dick
54   * Handle showUnhandledCookies.
55   *
56   * Revision 1.2  2008/12/13 06:24:30  dick
57   * Add NotReady and ShowUnhandledCookies.
58   *
59   * Revision 1.1  2008/12/11 08:49:05  dick
60   * Allow the user to manage his preferences.
61   */
62  
63  /* 
64   * This program is free software: you can redistribute it and/or modify
65   * it under the terms of the GNU General Public License as published by
66   * the Free Software Foundation, either version 3 of the License, or
67   * (at your option) any later version.
68   *
69   * This program is distributed in the hope that it will be useful,
70   * but WITHOUT ANY WARRANTY; without even the implied warranty of
71   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
72   * GNU General Public License for more details.
73   *
74   * You should have received a copy of the GNU General Public License
75   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
76   *
77   * The Original Code is BuckoFIBS, <http://www.buckosoft.com/BuckoFIBS/>.
78   * The Initial Developer of the Original Code is Dick Balaska and BuckoSoft, Corp.
79   * 
80   */
81  package com.buckosoft.fibs.BuckoFIBS.gui;
82  
83  import java.awt.Color;
84  import java.awt.Dimension;
85  import java.awt.Font;
86  import java.awt.GridBagConstraints;
87  import java.awt.GridBagLayout;
88  import java.awt.Insets;
89  
90  import javax.swing.BorderFactory;
91  import javax.swing.ButtonGroup;
92  import javax.swing.JButton;
93  import javax.swing.JCheckBox;
94  import javax.swing.JDialog;
95  import javax.swing.JFrame;
96  import javax.swing.JLabel;
97  import javax.swing.JPanel;
98  import javax.swing.JRadioButton;
99  import javax.swing.border.BevelBorder;
100 
101 import com.buckosoft.fibs.BuckoFIBS.BFProperties;
102 import com.buckosoft.fibs.BuckoFIBS.CommandDispatcher;
103 import javax.swing.JTextField;
104 
105 /** Allow the user to manage his preferences.
106  * @author Dick Balaska
107  * @since 2008/12/11
108  * @version $Revision$ <br> $Date$
109  * @see <a href="http://cvs.buckosoft.com/Projects/BuckoFIBS/BuckoFIBS/src/main/java/com/buckosoft/fibs/BuckoFIBS/gui/PreferencesDialog.java">cvs PreferencesDialog.java</a>
110  */
111 public class PreferencesDialog extends JDialog {
112 	private static final long serialVersionUID = 1L;
113 
114 	private	CommandDispatcher	commandDispatcher;  //  @jve:decl-index=0:
115 	private	BFProperties		properties;
116 
117 	private JPanel jContentPane = null;
118 	private JButton jButtonOK = null;
119 	private JButton jButtonCancel = null;
120 	private JPanel jPanelOkCancel = null;
121 	private JPanel jPanelPrefs = null;
122 	private JLabel jLabelAutoConnect = null;
123 	private JCheckBox jCheckBoxAutoConnectOnStartup = null;
124 	private JLabel jLabelSettingsLabel = null;
125 	private JLabel jLabelMultiplePersonalities = null;
126 	private JCheckBox jCheckBoxAllowMultiplePersonalities = null;
127 	private JLabel jLabel1 = null;
128 	private JCheckBox jCheckBoxShowPointNumbers = null;
129 	private JLabel jLabel = null;
130 	private JCheckBox jCheckBoxHoverHelpers = null;
131 	private JLabel jLabel2 = null;
132 	private JCheckBox jCheckBoxAudioCues = null;
133 	private JLabel jLabelAutoGreedyBearoff = null;
134 	private JCheckBox jCheckBoxAutoGreedyBearoff = null;
135 	private JPanel jPanelDice = null;
136 	private JLabel jLabelDice = null;
137 	private JLabel jLabelSwapDice = null;
138 	private JCheckBox jCheckBoxHighDieLeft = null;
139 	private JLabel jLabelRightClickSwapDice = null;
140 	private JLabel jLabelRightClickPlaysRightDie = null;
141 	private JRadioButton jRadioButtonRightClickPlaysRightDie = null;
142 	private JRadioButton jRadioButtonRightClickSwapsDice = null;
143 	private ButtonGroup rightDieButtonGroup = null;
144 	private JPanel jPanelSpacer = null;
145 	private JPanel jPanelSpacer1 = null;
146 	private JLabel jLabelAnimateMoves = null;
147 	private JCheckBox jCheckBoxAnimateMoves = null;
148 	private JLabel jLabelAnimate = null;
149 	private JLabel jLabelAnimateFlashing = null;
150 	private JRadioButton jRadioButtonAnimateFlashing = null;
151 	private JLabel jLabelAnimateSpline2D = null;
152 	private JRadioButton jRadioButtonAnimateSpline2D = null;
153 	private ButtonGroup animateTypeButtonGroup = null;
154 	private JPanel jPanelAnimateSpeed = null;
155 	private JLabel jLabelSecondsPerMove = null;
156 	private JTextField jTextFieldSecondsPerMove = null;
157 	private JLabel jLabelSwitchChatOnMessages = null;
158 	private JCheckBox jCheckBoxSwitchTabOnNewChatMessage = null;
159 	private JLabel jLabelDontSwitchOnShouts = null;
160 	private JCheckBox jCheckBoxDontChangeTabOnNewShouts = null;
161 
162 	/** no bean constructor allowed */
163 	protected PreferencesDialog() {
164 		super();
165 		initialize();
166 	}
167 
168 	/** Create and display the preferences dialog.
169 	 * Just set and forget.  It's modal and manages ok and cancel on its own.
170 	 * @param owner Probably an instance of MainDialog
171 	 * @param commandDispatcher The BuckoFIBS commandDispatcher
172 	 */
173 	public PreferencesDialog(JFrame owner, CommandDispatcher commandDispatcher) {
174 		super(owner, true);
175 		this.commandDispatcher = commandDispatcher;
176 		this.properties = commandDispatcher.getProperties();
177 		initialize();
178 		this.setLocationRelativeTo(owner);
179 		rightDieButtonGroup = new ButtonGroup();
180 		rightDieButtonGroup.add(jRadioButtonRightClickPlaysRightDie);
181 		rightDieButtonGroup.add(jRadioButtonRightClickSwapsDice);
182 		animateTypeButtonGroup = new ButtonGroup();
183 		animateTypeButtonGroup.add(jRadioButtonAnimateSpline2D);
184 		animateTypeButtonGroup.add(jRadioButtonAnimateFlashing);
185 		
186 
187 		BFProperties props = this.commandDispatcher.getProperties();
188 		this.jCheckBoxAutoConnectOnStartup.getModel().setSelected(props.isAutoConnect());
189 		this.jCheckBoxShowPointNumbers.getModel().setSelected(props.isShowPointNumbers());
190 		this.jCheckBoxAllowMultiplePersonalities.getModel().setSelected(props.isAllowMultiplePersonalities());
191 		this.jCheckBoxHoverHelpers.getModel().setSelected(props.isHoverHelpers());
192 		this.jCheckBoxAudioCues.getModel().setSelected(props.isAudioCues());
193 		this.jCheckBoxAutoGreedyBearoff.getModel().setSelected(props.isAutoGreedyBearOff());
194 		this.jCheckBoxAnimateMoves.getModel().setSelected(props.isAnimateMoves());
195 		this.jCheckBoxHighDieLeft.getModel().setSelected(props.isHighDieLeft());
196 		this.jCheckBoxSwitchTabOnNewChatMessage.getModel().setSelected(props.isChangeTabOnNewMsg());
197 		this.jCheckBoxDontChangeTabOnNewShouts.getModel().setSelected(props.isDontChangeTabOnShout());
198 		this.rightDieStateChanged(props.getRightDieType());
199 		this.enableAnimationChanged();
200 		switch (props.getAnimateType()) {
201 		case 0:
202 			this.jRadioButtonAnimateFlashing.getModel().setSelected(true);
203 			break;
204 		case 1:
205 			this.jRadioButtonAnimateSpline2D.getModel().setSelected(true);
206 			break;
207 		}
208 		this.jTextFieldSecondsPerMove.setText(new Double(props.getAnimateSpeed()).toString());
209 	}
210 
211 	private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {
212 		setVisible(false);
213 		this.properties.setAutoConnect(this.jCheckBoxAutoConnectOnStartup.getModel().isSelected());
214 		this.properties.setShowPointNumbers(this.jCheckBoxShowPointNumbers.getModel().isSelected());
215 		this.properties.setAllowMultiplePersonalities(this.jCheckBoxAllowMultiplePersonalities.getModel().isSelected());
216 		this.properties.setHoverHelpers(this.jCheckBoxHoverHelpers.getModel().isSelected());
217 		this.properties.setAudioCues(this.jCheckBoxAudioCues.getModel().isSelected());
218 		this.properties.setAutoGreedyBearOff(this.jCheckBoxAutoGreedyBearoff.getModel().isSelected());
219 		this.properties.setAnimateMoves(this.jCheckBoxAnimateMoves.getModel().isSelected());
220 		this.properties.setHighDieLeft(this.jCheckBoxHighDieLeft.getModel().isSelected());
221 		this.properties.setRightDieType(this.getRightDieState());
222 		this.properties.setAnimateMoves(this.jCheckBoxAnimateMoves.getModel().isSelected());
223 		this.properties.setChangeTabOnNewMsg(this.jCheckBoxSwitchTabOnNewChatMessage.getModel().isSelected());
224 		this.properties.setDontChangeTabOnShout(this.jCheckBoxDontChangeTabOnNewShouts.getModel().isSelected());
225 		int i = -1;
226 		if (this.jRadioButtonAnimateFlashing.getModel().isSelected())
227 			i = 0;
228 		if (this.jRadioButtonAnimateSpline2D.getModel().isSelected())
229 			i = 1;
230 		this.properties.setAnimateType(i);
231 		try {
232 			this.properties.setAnimateSpeed(Double.parseDouble(this.jTextFieldSecondsPerMove.getText()));
233 		} catch (NumberFormatException e) {
234 			this.properties.setAnimateSpeed(1.0);
235 		}
236 		dispose();
237 	}
238 
239 	private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
240 		setVisible(false);
241 		dispose();
242 	}
243 
244 	/**
245 	 * This method initializes this
246 	 * 
247 	 */
248 	private void initialize() {
249         this.setSize(new Dimension(623, 300));
250         this.setContentPane(getJContentPane());
251         this.setTitle("Preferences");
252 			
253 	}
254 
255 	/**
256 	 * This method initializes jContentPane	
257 	 * 	
258 	 * @return javax.swing.JPanel	
259 	 */
260 	private JPanel getJContentPane() {
261 		if (jContentPane == null) {
262 			jLabelDice = new JLabel();
263 			jLabelDice.setFont(new Font("Dialog", Font.BOLD, 14));
264 			jLabelDice.setText("Dice");
265 			jLabelDice.setForeground(new Color(102, 102, 0));
266 			GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
267 			gridBagConstraints13.gridx = 1;
268 			gridBagConstraints13.fill = GridBagConstraints.VERTICAL;
269 			gridBagConstraints13.weighty = 0.3;
270 			gridBagConstraints13.insets = new Insets(10, 10, 10, 0);
271 			gridBagConstraints13.gridy = 0;
272 			GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
273 			gridBagConstraints6.gridx = 0;
274 			gridBagConstraints6.weighty = 0.3;
275 			gridBagConstraints6.fill = GridBagConstraints.VERTICAL;
276 			gridBagConstraints6.insets = new Insets(10, 0, 10, 0);
277 			gridBagConstraints6.gridheight = 2;
278 			gridBagConstraints6.gridy = 0;
279 			GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
280 			gridBagConstraints2.gridx = 0;
281 			gridBagConstraints2.anchor = GridBagConstraints.SOUTH;
282 			gridBagConstraints2.weighty = 0.2;
283 			gridBagConstraints2.gridwidth = 2;
284 			gridBagConstraints2.insets = new Insets(0, 0, 5, 0);
285 			gridBagConstraints2.gridy = 2;
286 			jContentPane = new JPanel();
287 			jContentPane.setLayout(new GridBagLayout());
288 			jContentPane.add(getJPanelOkCancel(), gridBagConstraints2);
289 			jContentPane.add(getJPanelPrefs(), gridBagConstraints6);
290 			jContentPane.add(getJPanelDice(), gridBagConstraints13);
291 		}
292 		return jContentPane;
293 	}
294 
295 	/**
296 	 * This method initializes jButtonOK	
297 	 * 	
298 	 * @return javax.swing.JButton	
299 	 */
300 	private JButton getJButtonOK() {
301 		if (jButtonOK == null) {
302 			jButtonOK = new JButton();
303 			jButtonOK.setText("OK");
304 			jButtonOK.addActionListener(new java.awt.event.ActionListener() {
305 				public void actionPerformed(java.awt.event.ActionEvent e) {
306 					okButtonActionPerformed(e);
307 				}
308 			});
309 		}
310 		return jButtonOK;
311 	}
312 
313 	/**
314 	 * This method initializes jButtonCancel	
315 	 * 	
316 	 * @return javax.swing.JButton	
317 	 */
318 	private JButton getJButtonCancel() {
319 		if (jButtonCancel == null) {
320 			jButtonCancel = new JButton();
321 			jButtonCancel.setText("Cancel");
322 			jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
323 				public void actionPerformed(java.awt.event.ActionEvent e) {
324 					cancelButtonActionPerformed(e);
325 				}
326 			});
327 		}
328 		return jButtonCancel;
329 	}
330 
331 	/**
332 	 * This method initializes jPanelOkCancel	
333 	 * 	
334 	 * @return javax.swing.JPanel	
335 	 */
336 	private JPanel getJPanelOkCancel() {
337 		if (jPanelOkCancel == null) {
338 			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
339 			gridBagConstraints1.gridx = -1;
340 			gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
341 			gridBagConstraints1.insets = new Insets(0, 15, 0, 0);
342 			gridBagConstraints1.gridy = -1;
343 			GridBagConstraints gridBagConstraints = new GridBagConstraints();
344 			gridBagConstraints.gridx = -1;
345 			gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
346 			gridBagConstraints.anchor = GridBagConstraints.EAST;
347 			gridBagConstraints.weightx = 0.1;
348 			gridBagConstraints.insets = new Insets(0, 0, 0, 15);
349 			gridBagConstraints.gridy = -1;
350 			jPanelOkCancel = new JPanel();
351 			jPanelOkCancel.setLayout(new GridBagLayout());
352 			jPanelOkCancel.add(getJButtonOK(), gridBagConstraints);
353 			jPanelOkCancel.add(getJButtonCancel(), gridBagConstraints1);
354 		}
355 		return jPanelOkCancel;
356 	}
357 
358 	/**
359 	 * This method initializes jPanelPrefs	
360 	 * 	
361 	 * @return javax.swing.JPanel	
362 	 */
363 	private JPanel getJPanelPrefs() {
364 		if (jPanelPrefs == null) {
365 			GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
366 			gridBagConstraints41.gridx = 1;
367 			gridBagConstraints41.gridy = 8;
368 			GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
369 			gridBagConstraints40.gridx = 0;
370 			gridBagConstraints40.anchor = GridBagConstraints.WEST;
371 			gridBagConstraints40.insets = new Insets(0, 15, 0, 0);
372 			gridBagConstraints40.gridy = 8;
373 			jLabelDontSwitchOnShouts = new JLabel();
374 			jLabelDontSwitchOnShouts.setText("Don't switch on new shouts:");
375 			GridBagConstraints gridBagConstraints39 = new GridBagConstraints();
376 			gridBagConstraints39.gridx = 1;
377 			gridBagConstraints39.gridy = 7;
378 			GridBagConstraints gridBagConstraints38 = new GridBagConstraints();
379 			gridBagConstraints38.gridx = 0;
380 			gridBagConstraints38.anchor = GridBagConstraints.WEST;
381 			gridBagConstraints38.gridy = 7;
382 			jLabelSwitchChatOnMessages = new JLabel();
383 			jLabelSwitchChatOnMessages.setText("Switch tabs on new chat messages:");
384 			jLabelAnimateMoves = new JLabel();
385 			jLabelAnimateMoves.setText("Enable Checker Animation");
386 			GridBagConstraints gridBagConstraints27 = new GridBagConstraints();
387 			gridBagConstraints27.gridx = 0;
388 			gridBagConstraints27.fill = GridBagConstraints.VERTICAL;
389 			gridBagConstraints27.weighty = 0.1;
390 			gridBagConstraints27.gridy = 9;
391 			GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
392 			gridBagConstraints9.gridx = 1;
393 			gridBagConstraints9.gridy = 6;
394 			GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
395 			gridBagConstraints8.gridx = 0;
396 			gridBagConstraints8.gridy = 6;
397 			jLabelAutoGreedyBearoff = new JLabel();
398 			jLabelAutoGreedyBearoff.setText("Turn on Greedy Bear off when game is a race:");
399 			GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
400 			gridBagConstraints7.gridx = 1;
401 			gridBagConstraints7.gridy = 2;
402 			GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
403 			gridBagConstraints5.gridx = 0;
404 			gridBagConstraints5.anchor = GridBagConstraints.WEST;
405 			gridBagConstraints5.gridy = 2;
406 			jLabel2 = new JLabel();
407 			jLabel2.setText("Make Noise:");
408 			GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
409 			gridBagConstraints4.gridx = 1;
410 			gridBagConstraints4.gridy = 5;
411 			GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
412 			gridBagConstraints3.gridx = 0;
413 			gridBagConstraints3.anchor = GridBagConstraints.WEST;
414 			gridBagConstraints3.gridy = 5;
415 			jLabel = new JLabel();
416 			jLabel.setText("Hover Helpers on the board:");
417 			GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
418 			gridBagConstraints22.gridx = 1;
419 			gridBagConstraints22.gridy = 4;
420 			GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
421 			gridBagConstraints21.gridx = 0;
422 			gridBagConstraints21.anchor = GridBagConstraints.WEST;
423 			gridBagConstraints21.insets = new Insets(0, 0, 0, 8);
424 			gridBagConstraints21.gridy = 4;
425 			jLabel1 = new JLabel();
426 			jLabel1.setText("Show Numbers on the points:");
427 			GridBagConstraints gridBagConstraints18 = new GridBagConstraints();
428 			gridBagConstraints18.gridx = 1;
429 			gridBagConstraints18.gridy = 3;
430 			GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
431 			gridBagConstraints17.gridx = 0;
432 			gridBagConstraints17.anchor = GridBagConstraints.WEST;
433 			gridBagConstraints17.gridy = 3;
434 			jLabelMultiplePersonalities = new JLabel();
435 			jLabelMultiplePersonalities.setText("Allow Multiple Personalities:");
436 			GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
437 			gridBagConstraints12.gridy = 1;
438 			GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
439 			gridBagConstraints11.gridx = 0;
440 			gridBagConstraints11.anchor = GridBagConstraints.NORTHWEST;
441 			gridBagConstraints11.gridy = 0;
442 			jLabelSettingsLabel = new JLabel();
443 			jLabelSettingsLabel.setText("Settings:");
444 			jLabelSettingsLabel.setForeground(new Color(102, 102, 0));
445 			jLabelSettingsLabel.setFont(new Font("Dialog", Font.BOLD, 14));
446 			GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
447 			gridBagConstraints10.anchor = GridBagConstraints.WEST;
448 			gridBagConstraints10.gridy = 1;
449 			gridBagConstraints10.weightx = 0.2;
450 			jLabelAutoConnect = new JLabel();
451 			jLabelAutoConnect.setText("Auto Connect on Startup:");
452 			jPanelPrefs = new JPanel();
453 			jPanelPrefs.setLayout(new GridBagLayout());
454 			jPanelPrefs.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
455 			jPanelPrefs.add(jLabelAutoConnect, gridBagConstraints10);
456 			jPanelPrefs.add(getJCheckBoxAutoConnectOnStartup(), gridBagConstraints12);
457 			jPanelPrefs.add(jLabelSettingsLabel, gridBagConstraints11);
458 			jPanelPrefs.add(jLabelMultiplePersonalities, gridBagConstraints17);
459 			jPanelPrefs.add(getJCheckBoxAllowMultiplePersonalities(), gridBagConstraints18);
460 			jPanelPrefs.add(jLabel1, gridBagConstraints21);
461 			jPanelPrefs.add(getJCheckBoxShowPointNumbers(), gridBagConstraints22);
462 			jPanelPrefs.add(jLabel, gridBagConstraints3);
463 			jPanelPrefs.add(getJCheckBoxHoverHelpers(), gridBagConstraints4);
464 			jPanelPrefs.add(jLabel2, gridBagConstraints5);
465 			jPanelPrefs.add(getJCheckBoxAudioCues(), gridBagConstraints7);
466 			jPanelPrefs.add(jLabelAutoGreedyBearoff, gridBagConstraints8);
467 			jPanelPrefs.add(getJCheckBoxAutoGreedyBearoff(), gridBagConstraints9);
468 			jPanelPrefs.add(getJPanelSpacer1(), gridBagConstraints27);
469 			jPanelPrefs.add(jLabelSwitchChatOnMessages, gridBagConstraints38);
470 			jPanelPrefs.add(getJCheckBoxSwitchTabOnNewChatMessage(), gridBagConstraints39);
471 			jPanelPrefs.add(jLabelDontSwitchOnShouts, gridBagConstraints40);
472 			jPanelPrefs.add(getJCheckBoxDontChangeTabOnNewShouts(), gridBagConstraints41);
473 		}
474 		return jPanelPrefs;
475 	}
476 
477 	/**
478 	 * This method initializes jCheckBoxAutoConnectOnStartup	
479 	 * 	
480 	 * @return javax.swing.JCheckBox	
481 	 */
482 	private JCheckBox getJCheckBoxAutoConnectOnStartup() {
483 		if (jCheckBoxAutoConnectOnStartup == null) {
484 			jCheckBoxAutoConnectOnStartup = new JCheckBox();
485 		}
486 		return jCheckBoxAutoConnectOnStartup;
487 	}
488 
489 	/**
490 	 * This method initializes jCheckBoxAllowMultiplePersonalities	
491 	 * 	
492 	 * @return javax.swing.JCheckBox	
493 	 */
494 	private JCheckBox getJCheckBoxAllowMultiplePersonalities() {
495 		if (jCheckBoxAllowMultiplePersonalities == null) {
496 			jCheckBoxAllowMultiplePersonalities = new JCheckBox();
497 		}
498 		return jCheckBoxAllowMultiplePersonalities;
499 	}
500 
501 	/**
502 	 * This method initializes jCheckBoxShowPointNumbers	
503 	 * 	
504 	 * @return javax.swing.JCheckBox	
505 	 */
506 	private JCheckBox getJCheckBoxShowPointNumbers() {
507 		if (jCheckBoxShowPointNumbers == null) {
508 			jCheckBoxShowPointNumbers = new JCheckBox();
509 		}
510 		return jCheckBoxShowPointNumbers;
511 	}
512 
513 	/**
514 	 * This method initializes jCheckBoxHoverHelpers	
515 	 * 	
516 	 * @return javax.swing.JCheckBox	
517 	 */
518 	private JCheckBox getJCheckBoxHoverHelpers() {
519 		if (jCheckBoxHoverHelpers == null) {
520 			jCheckBoxHoverHelpers = new JCheckBox();
521 		}
522 		return jCheckBoxHoverHelpers;
523 	}
524 
525 	/**
526 	 * This method initializes jCheckBoxAudioCues	
527 	 * 	
528 	 * @return javax.swing.JCheckBox	
529 	 */
530 	private JCheckBox getJCheckBoxAudioCues() {
531 		if (jCheckBoxAudioCues == null) {
532 			jCheckBoxAudioCues = new JCheckBox();
533 		}
534 		return jCheckBoxAudioCues;
535 	}
536 
537 	/**
538 	 * This method initializes jCheckBoxAutoGreedyBearoff	
539 	 * 	
540 	 * @return javax.swing.JCheckBox	
541 	 */
542 	private JCheckBox getJCheckBoxAutoGreedyBearoff() {
543 		if (jCheckBoxAutoGreedyBearoff == null) {
544 			jCheckBoxAutoGreedyBearoff = new JCheckBox();
545 		}
546 		return jCheckBoxAutoGreedyBearoff;
547 	}
548 
549 	/**
550 	 * This method initializes jPanelDice	
551 	 * 	
552 	 * @return javax.swing.JPanel	
553 	 */
554 	private JPanel getJPanelDice() {
555 		if (jPanelDice == null) {
556 			GridBagConstraints gridBagConstraints35 = new GridBagConstraints();
557 			gridBagConstraints35.gridx = 0;
558 			gridBagConstraints35.fill = GridBagConstraints.HORIZONTAL;
559 			gridBagConstraints35.gridwidth = 2;
560 			gridBagConstraints35.anchor = GridBagConstraints.WEST;
561 			gridBagConstraints35.gridy = 8;
562 			GridBagConstraints gridBagConstraints34 = new GridBagConstraints();
563 			gridBagConstraints34.gridx = 1;
564 			gridBagConstraints34.gridy = 7;
565 			GridBagConstraints gridBagConstraints33 = new GridBagConstraints();
566 			gridBagConstraints33.gridx = 0;
567 			gridBagConstraints33.anchor = GridBagConstraints.WEST;
568 			gridBagConstraints33.fill = GridBagConstraints.HORIZONTAL;
569 			gridBagConstraints33.insets = new Insets(0, 10, 0, 0);
570 			gridBagConstraints33.gridy = 7;
571 			jLabelAnimateSpline2D = new JLabel();
572 			jLabelAnimateSpline2D.setText("Spline2D");
573 			GridBagConstraints gridBagConstraints32 = new GridBagConstraints();
574 			gridBagConstraints32.gridx = 1;
575 			gridBagConstraints32.gridy = 6;
576 			GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
577 			gridBagConstraints31.gridx = 0;
578 			gridBagConstraints31.anchor = GridBagConstraints.WEST;
579 			gridBagConstraints31.fill = GridBagConstraints.HORIZONTAL;
580 			gridBagConstraints31.insets = new Insets(0, 10, 0, 0);
581 			gridBagConstraints31.gridy = 6;
582 			jLabelAnimateFlashing = new JLabel();
583 			jLabelAnimateFlashing.setText("Flashing:");
584 			GridBagConstraints gridBagConstraints29 = new GridBagConstraints();
585 			gridBagConstraints29.gridx = 1;
586 			gridBagConstraints29.gridy = 5;
587 			GridBagConstraints gridBagConstraints28 = new GridBagConstraints();
588 			gridBagConstraints28.anchor = GridBagConstraints.WEST;
589 			gridBagConstraints28.gridx = 0;
590 			gridBagConstraints28.gridy = 5;
591 			gridBagConstraints28.fill = GridBagConstraints.NONE;
592 			GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
593 			gridBagConstraints30.gridx = 0;
594 			gridBagConstraints30.anchor = GridBagConstraints.WEST;
595 			gridBagConstraints30.insets = new Insets(3, 0, 0, 0);
596 			gridBagConstraints30.gridy = 4;
597 			jLabelAnimate = new JLabel();
598 			jLabelAnimate.setText("Animation:");
599 			jLabelAnimate.setForeground(new Color(102, 102, 0));
600 			jLabelAnimate.setFont(new Font("Dialog", Font.BOLD, 14));
601 			GridBagConstraints gridBagConstraints26 = new GridBagConstraints();
602 			gridBagConstraints26.gridx = 0;
603 			gridBagConstraints26.fill = GridBagConstraints.VERTICAL;
604 			gridBagConstraints26.weighty = 0.1;
605 			gridBagConstraints26.gridy = 9;
606 			GridBagConstraints gridBagConstraints25 = new GridBagConstraints();
607 			gridBagConstraints25.gridx = 1;
608 			gridBagConstraints25.gridy = 3;
609 			GridBagConstraints gridBagConstraints24 = new GridBagConstraints();
610 			gridBagConstraints24.gridx = 1;
611 			gridBagConstraints24.gridy = 2;
612 			GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
613 			gridBagConstraints23.gridx = 0;
614 			gridBagConstraints23.anchor = GridBagConstraints.WEST;
615 			gridBagConstraints23.fill = GridBagConstraints.HORIZONTAL;
616 			gridBagConstraints23.gridy = 2;
617 			jLabelRightClickPlaysRightDie = new JLabel();
618 			jLabelRightClickPlaysRightDie.setText("Right click plays right die:");
619 			GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
620 			gridBagConstraints20.gridx = 0;
621 			gridBagConstraints20.anchor = GridBagConstraints.WEST;
622 			gridBagConstraints20.fill = GridBagConstraints.HORIZONTAL;
623 			gridBagConstraints20.gridy = 3;
624 			jLabelRightClickSwapDice = new JLabel();
625 			jLabelRightClickSwapDice.setText("Right click swaps dice:");
626 			GridBagConstraints gridBagConstraints19 = new GridBagConstraints();
627 			gridBagConstraints19.gridx = 1;
628 			gridBagConstraints19.gridy = 1;
629 			GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
630 			gridBagConstraints16.gridx = 0;
631 			gridBagConstraints16.weighty = 0.0;
632 			gridBagConstraints16.anchor = GridBagConstraints.WEST;
633 			gridBagConstraints16.fill = GridBagConstraints.HORIZONTAL;
634 			gridBagConstraints16.gridy = 1;
635 			jLabelSwapDice = new JLabel();
636 			jLabelSwapDice.setText("Put the high die on the left:");
637 			jLabelSwapDice.setToolTipText("Always ");
638 			GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
639 			gridBagConstraints15.insets = new Insets(0, 0, 0, 0);
640 			gridBagConstraints15.gridy = 0;
641 			gridBagConstraints15.anchor = GridBagConstraints.NORTHWEST;
642 			gridBagConstraints15.weighty = 0.0;
643 			gridBagConstraints15.gridx = 0;
644 			GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
645 			gridBagConstraints14.gridx = -1;
646 			gridBagConstraints14.anchor = GridBagConstraints.NORTHWEST;
647 			gridBagConstraints14.gridy = -1;
648 			jPanelDice = new JPanel();
649 			jPanelDice.setLayout(new GridBagLayout());
650 			jPanelDice.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
651 			jPanelDice.add(jLabelDice, gridBagConstraints15);
652 			jPanelDice.add(jLabelSwapDice, gridBagConstraints16);
653 			jPanelDice.add(getJCheckBoxHighDieLeft(), gridBagConstraints19);
654 			jPanelDice.add(jLabelRightClickSwapDice, gridBagConstraints20);
655 			jPanelDice.add(jLabelRightClickPlaysRightDie, gridBagConstraints23);
656 			jPanelDice.add(getJRadioButtonRightClickPlaysRightDie(), gridBagConstraints24);
657 			jPanelDice.add(getJRadioButtonRightClickSwapsDice(), gridBagConstraints25);
658 			jPanelDice.add(getJPanelSpacer(), gridBagConstraints26);
659 			jPanelDice.add(jLabelAnimate, gridBagConstraints30);
660 			jPanelDice.add(jLabelAnimateMoves, gridBagConstraints28);
661 			jPanelDice.add(getJCheckBoxAnimateMoves(), gridBagConstraints29);
662 			jPanelDice.add(jLabelAnimateFlashing, gridBagConstraints31);
663 			jPanelDice.add(getJRadioButtonAnimateFlashing(), gridBagConstraints32);
664 			jPanelDice.add(jLabelAnimateSpline2D, gridBagConstraints33);
665 			jPanelDice.add(getJRadioButtonAnimateSpline2D(), gridBagConstraints34);
666 			jPanelDice.add(getJPanelAnimateSpeed(), gridBagConstraints35);
667 		}
668 		return jPanelDice;
669 	}
670 
671 	/**
672 	 * This method initializes jCheckBoxHighDieLeft	
673 	 * 	
674 	 * @return javax.swing.JCheckBox	
675 	 */
676 	private JCheckBox getJCheckBoxHighDieLeft() {
677 		if (jCheckBoxHighDieLeft == null) {
678 			jCheckBoxHighDieLeft = new JCheckBox();
679 		}
680 		return jCheckBoxHighDieLeft;
681 	}
682 
683 	/**
684 	 * This method initializes jRadioButtonRightClickPlaysRightDie	
685 	 * 	
686 	 * @return javax.swing.JRadioButton	
687 	 */
688 	private JRadioButton getJRadioButtonRightClickPlaysRightDie() {
689 		if (jRadioButtonRightClickPlaysRightDie == null) {
690 			jRadioButtonRightClickPlaysRightDie = new JRadioButton();
691 		}
692 		return jRadioButtonRightClickPlaysRightDie;
693 	}
694 
695 	/**
696 	 * This method initializes jRadioButtonRightClickSwapsDice	
697 	 * 	
698 	 * @return javax.swing.JRadioButton	
699 	 */
700 	private JRadioButton getJRadioButtonRightClickSwapsDice() {
701 		if (jRadioButtonRightClickSwapsDice == null) {
702 			jRadioButtonRightClickSwapsDice = new JRadioButton();
703 		}
704 		return jRadioButtonRightClickSwapsDice;
705 	}
706 
707 	private void rightDieStateChanged(int rightDieType) {
708 		if (rightDieType == BFProperties.RIGHT_DIE_SWAPS)
709 			jRadioButtonRightClickSwapsDice.setSelected(true);
710 		else
711 			jRadioButtonRightClickPlaysRightDie.setSelected(true);
712 	}
713 
714 	private int getRightDieState() {
715 		if (jRadioButtonRightClickPlaysRightDie.isSelected())
716 			return(BFProperties.RIGHT_DIE_PLAYS);
717 		else
718 			return(BFProperties.RIGHT_DIE_SWAPS);
719 	}
720 
721 	/**
722 	 * This method initializes jPanelSpacer	
723 	 * 	
724 	 * @return javax.swing.JPanel	
725 	 */
726 	private JPanel getJPanelSpacer() {
727 		if (jPanelSpacer == null) {
728 			jPanelSpacer = new JPanel();
729 			jPanelSpacer.setLayout(new GridBagLayout());
730 		}
731 		return jPanelSpacer;
732 	}
733 
734 	/**
735 	 * This method initializes jPanelSpacer1	
736 	 * 	
737 	 * @return javax.swing.JPanel	
738 	 */
739 	private JPanel getJPanelSpacer1() {
740 		if (jPanelSpacer1 == null) {
741 			jPanelSpacer1 = new JPanel();
742 			jPanelSpacer1.setLayout(new GridBagLayout());
743 		}
744 		return jPanelSpacer1;
745 	}
746 
747 	/**
748 	 * This method initializes jCheckBoxAnimateMoves	
749 	 * 	
750 	 * @return javax.swing.JCheckBox	
751 	 */
752 	private JCheckBox getJCheckBoxAnimateMoves() {
753 		if (jCheckBoxAnimateMoves == null) {
754 			jCheckBoxAnimateMoves = new JCheckBox();
755 			jCheckBoxAnimateMoves.addItemListener(new java.awt.event.ItemListener() {
756 				public void itemStateChanged(java.awt.event.ItemEvent e) {
757 					enableAnimationChanged();
758 				}
759 			});
760 		}
761 		return jCheckBoxAnimateMoves;
762 	}
763 
764 	private	void	enableAnimationChanged() {
765 		boolean b = jCheckBoxAnimateMoves.getModel().isSelected();
766 		this.jLabelAnimateFlashing.setEnabled(b);
767 		this.jRadioButtonAnimateFlashing.setEnabled(b);
768 		this.jLabelAnimateSpline2D.setEnabled(b);
769 		this.jRadioButtonAnimateSpline2D.setEnabled(b);
770 		this.jLabelSecondsPerMove.setEnabled(b);
771 		this.jTextFieldSecondsPerMove.setEnabled(b);
772 	}
773 	/**
774 	 * This method initializes jRadioButtonAnimateFlashing	
775 	 * 	
776 	 * @return javax.swing.JRadioButton	
777 	 */
778 	private JRadioButton getJRadioButtonAnimateFlashing() {
779 		if (jRadioButtonAnimateFlashing == null) {
780 			jRadioButtonAnimateFlashing = new JRadioButton();
781 		}
782 		return jRadioButtonAnimateFlashing;
783 	}
784 
785 	/**
786 	 * This method initializes jRadioButtonAnimateSpline2D	
787 	 * 	
788 	 * @return javax.swing.JRadioButton	
789 	 */
790 	private JRadioButton getJRadioButtonAnimateSpline2D() {
791 		if (jRadioButtonAnimateSpline2D == null) {
792 			jRadioButtonAnimateSpline2D = new JRadioButton();
793 		}
794 		return jRadioButtonAnimateSpline2D;
795 	}
796 
797 	/**
798 	 * This method initializes jPanelAnimateSpeed	
799 	 * 	
800 	 * @return javax.swing.JPanel	
801 	 */
802 	private JPanel getJPanelAnimateSpeed() {
803 		if (jPanelAnimateSpeed == null) {
804 			GridBagConstraints gridBagConstraints37 = new GridBagConstraints();
805 			gridBagConstraints37.fill = GridBagConstraints.BOTH;
806 			gridBagConstraints37.gridy = 0;
807 			gridBagConstraints37.weightx = 1.0;
808 			gridBagConstraints37.gridx = 1;
809 			GridBagConstraints gridBagConstraints36 = new GridBagConstraints();
810 			gridBagConstraints36.anchor = GridBagConstraints.WEST;
811 			gridBagConstraints36.insets = new Insets(0, 0, 0, 16);
812 			jLabelSecondsPerMove = new JLabel();
813 			jLabelSecondsPerMove.setText("Seconds per move:");
814 			jPanelAnimateSpeed = new JPanel();
815 			jPanelAnimateSpeed.setLayout(new GridBagLayout());
816 			jPanelAnimateSpeed.add(jLabelSecondsPerMove, gridBagConstraints36);
817 			jPanelAnimateSpeed.add(getJTextFieldSecondsPerMove(), gridBagConstraints37);
818 		}
819 		return jPanelAnimateSpeed;
820 	}
821 
822 	/**
823 	 * This method initializes jTextFieldSecondsPerMove	
824 	 * 	
825 	 * @return javax.swing.JTextField	
826 	 */
827 	private JTextField getJTextFieldSecondsPerMove() {
828 		if (jTextFieldSecondsPerMove == null) {
829 			jTextFieldSecondsPerMove = new JTextField();
830 			jTextFieldSecondsPerMove.setText("2.0");
831 		}
832 		return jTextFieldSecondsPerMove;
833 	}
834 
835 	/**
836 	 * This method initializes jCheckBoxSwitchTabOnNewChatMessage	
837 	 * 	
838 	 * @return javax.swing.JCheckBox	
839 	 */
840 	private JCheckBox getJCheckBoxSwitchTabOnNewChatMessage() {
841 		if (jCheckBoxSwitchTabOnNewChatMessage == null) {
842 			jCheckBoxSwitchTabOnNewChatMessage = new JCheckBox();
843 		}
844 		return jCheckBoxSwitchTabOnNewChatMessage;
845 	}
846 
847 	/**
848 	 * This method initializes jCheckBoxDontChangeTabOnNewShouts	
849 	 * 	
850 	 * @return javax.swing.JCheckBox	
851 	 */
852 	private JCheckBox getJCheckBoxDontChangeTabOnNewShouts() {
853 		if (jCheckBoxDontChangeTabOnNewShouts == null) {
854 			jCheckBoxDontChangeTabOnNewShouts = new JCheckBox();
855 		}
856 		return jCheckBoxDontChangeTabOnNewShouts;
857 	}
858 
859 }  //  @jve:decl-index=0:visual-constraint="10,10"