Coverage Report - com.buckosoft.fibs.BuckoFIBS.gui.account.NewbieDialog
 
Classes in this File Line Coverage Branch Coverage Complexity
NewbieDialog
0%
0/111
0%
0/10
1.455
NewbieDialog$1
0%
0/5
N/A
1.455
NewbieDialog$2
0%
0/5
N/A
1.455
NewbieDialog$3
0%
0/5
N/A
1.455
 
 1  
 /******************************************************************************
 2  
  * NewbieDialog.java - Display this dialog the very first time BuckoFIBS is run.
 3  
  * $Id$
 4  
  * 
 5  
  * BuckoFIBS - Backgammon by BuckoSoft
 6  
  * Copyright© 2011 - Dick Balaska - BuckoSoft, Corp.
 7  
  * 
 8  
  * $Log$
 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  
 /** Display this dialog the very first time BuckoFIBS is run.
 23  
  * @author Dick Balaska
 24  
  * @since 2011/07/01
 25  
  * @version $Revision$ <br> $Date$
 26  
  * @see <a href="http://cvs.buckosoft.com/Projects/BuckoFIBS/BuckoFIBS/src/com/buckosoft/fibs/BuckoFIBS/gui/account/NewbieDialog.java">cvs NewbieDialog.java</a>
 27  
  */
 28  0
 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  0
         private        int                returnValue = -1;
 36  
 
 37  
 //        private        NewbieDialog newbieDialog = this;
 38  0
         private JPanel jContentPane = null;
 39  0
         private JLabel jLabelNewbie = null;
 40  0
         private JLabel jLabelFirstTime = null;
 41  0
         private JLabel jLabelChoice = null;
 42  0
         private JPanel jPanelButtons = null;
 43  0
         private JButton jButtonImport = null;
 44  0
         private JButton jButtonNew = null;
 45  0
         private JButton jButtonCancel = null;
 46  0
         private JLabel jLabelCreateNew = null;
 47  
 
 48  
 
 49  0
         private JLabel jLabelUseless = null;
 50  
 
 51  
         /** Create the NewbieDialog
 52  
          * @param owner The MainDialog to center over
 53  
          * @param modal should be true...
 54  
          */
 55  
         public NewbieDialog(JFrame owner) {
 56  0
                 super(owner, true);
 57  0
                 initialize();
 58  0
                 this.setLocationRelativeTo(owner);
 59  0
         }
 60  
 
 61  
         /**
 62  
          * This method initializes this
 63  
          * 
 64  
          * @return void
 65  
          */
 66  
         private void initialize() {
 67  0
                 this.setSize(374, 249);
 68  0
                 this.setTitle("Newbie");
 69  0
                 this.setContentPane(getJContentPane());
 70  0
         }
 71  
 
 72  
         
 73  
         /** Return the value set
 74  
          * @return the returnValue
 75  
          */
 76  
         public int getReturnValue() {
 77  0
                 return returnValue;
 78  
         }
 79  
 
 80  
         /**
 81  
          * This method initializes jContentPane
 82  
          * 
 83  
          * @return javax.swing.JPanel
 84  
          */
 85  
         private JPanel getJContentPane() {
 86  0
                 if (jContentPane == null) {
 87  0
                         GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
 88  0
                         gridBagConstraints12.gridx = 0;
 89  0
                         gridBagConstraints12.anchor = GridBagConstraints.NORTHWEST;
 90  0
                         gridBagConstraints12.weighty = 0.0;
 91  0
                         gridBagConstraints12.ipady = 0;
 92  0
                         gridBagConstraints12.insets = new Insets(0, 0, 6, 0);
 93  0
                         gridBagConstraints12.gridy = 2;
 94  0
                         jLabelUseless = new JLabel();
 95  0
                         jLabelUseless.setText("This program is only useful as a connector to FIBS.");
 96  0
                         GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
 97  0
                         gridBagConstraints11.gridx = 0;
 98  0
                         gridBagConstraints11.anchor = GridBagConstraints.NORTHWEST;
 99  0
                         gridBagConstraints11.gridy = 4;
 100  0
                         jLabelCreateNew = new JLabel();
 101  0
                         jLabelCreateNew.setText("Or we can create you a new account");
 102  0
                         GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
 103  0
                         gridBagConstraints3.gridx = 0;
 104  0
                         gridBagConstraints3.fill = GridBagConstraints.BOTH;
 105  0
                         gridBagConstraints3.weighty = 10.0;
 106  0
                         gridBagConstraints3.gridy = 5;
 107  0
                         GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
 108  0
                         gridBagConstraints2.gridx = 0;
 109  0
                         gridBagConstraints2.weighty = 0.0;
 110  0
                         gridBagConstraints2.anchor = GridBagConstraints.NORTHWEST;
 111  0
                         gridBagConstraints2.gridy = 3;
 112  0
                         jLabelChoice = new JLabel();
 113  0
                         jLabelChoice.setText("If you have a FIBS account, you can use it");
 114  0
                         GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
 115  0
                         gridBagConstraints1.gridx = 0;
 116  0
                         gridBagConstraints1.anchor = GridBagConstraints.NORTHWEST;
 117  0
                         gridBagConstraints1.weighty = 0.0;
 118  0
                         gridBagConstraints1.gridy = 1;
 119  0
                         jLabelFirstTime = new JLabel();
 120  0
                         jLabelFirstTime.setText("This appears to be the first time you have run BuckoFIBS");
 121  0
                         GridBagConstraints gridBagConstraints = new GridBagConstraints();
 122  0
                         gridBagConstraints.insets = new Insets(0, 0, 0, 0);
 123  0
                         gridBagConstraints.gridy = 0;
 124  0
                         gridBagConstraints.ipadx = 0;
 125  0
                         gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
 126  0
                         gridBagConstraints.weighty = 1.0;
 127  0
                         gridBagConstraints.gridx = 0;
 128  0
                         jLabelNewbie = new JLabel();
 129  0
                         jLabelNewbie.setText("Hello Newbie!");
 130  0
                         jContentPane = new JPanel();
 131  0
                         jContentPane.setLayout(new GridBagLayout());
 132  0
                         jContentPane.add(jLabelNewbie, gridBagConstraints);
 133  0
                         jContentPane.add(jLabelFirstTime, gridBagConstraints1);
 134  0
                         jContentPane.add(jLabelChoice, gridBagConstraints2);
 135  0
                         jContentPane.add(getJPanelButtons(), gridBagConstraints3);
 136  0
                         jContentPane.add(jLabelCreateNew, gridBagConstraints11);
 137  0
                         jContentPane.add(jLabelUseless, gridBagConstraints12);
 138  
                 }
 139  0
                 return jContentPane;
 140  
         }
 141  
 
 142  
         /**
 143  
          * This method initializes jPanelButtons        
 144  
          *         
 145  
          * @return javax.swing.JPanel        
 146  
          */
 147  
         private JPanel getJPanelButtons() {
 148  0
                 if (jPanelButtons == null) {
 149  0
                         GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
 150  0
                         gridBagConstraints6.gridx = 0;
 151  0
                         gridBagConstraints6.gridwidth = 2;
 152  0
                         gridBagConstraints6.insets = new Insets(5, 0, 0, 0);
 153  0
                         gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
 154  0
                         gridBagConstraints6.gridy = 2;
 155  0
                         GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
 156  0
                         gridBagConstraints5.gridx = 0;
 157  0
                         gridBagConstraints5.insets = new Insets(0, 0, 5, 0);
 158  0
                         gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
 159  0
                         gridBagConstraints5.gridy = 0;
 160  0
                         GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
 161  0
                         gridBagConstraints4.gridx = 0;
 162  0
                         gridBagConstraints4.insets = new Insets(0, 0, 5, 0);
 163  0
                         gridBagConstraints4.gridy = 1;
 164  0
                         jPanelButtons = new JPanel();
 165  0
                         jPanelButtons.setLayout(new GridBagLayout());
 166  0
                         jPanelButtons.add(getJButtonImport(), gridBagConstraints4);
 167  0
                         jPanelButtons.add(getJButtonNew(), gridBagConstraints5);
 168  0
                         jPanelButtons.add(getJButtonCancel(), gridBagConstraints6);
 169  
                 }
 170  0
                 return jPanelButtons;
 171  
         }
 172  
 
 173  
         /**
 174  
          * This method initializes jButtonImport        
 175  
          *         
 176  
          * @return javax.swing.JButton        
 177  
          */
 178  
         private JButton getJButtonImport() {
 179  0
                 if (jButtonImport == null) {
 180  0
                         jButtonImport = new JButton();
 181  0
                         jButtonImport.setText("Use my existing FIBS account");
 182  0
                         jButtonImport.addActionListener(new java.awt.event.ActionListener() {
 183  
                                 public void actionPerformed(java.awt.event.ActionEvent e) {
 184  0
                                         System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
 185  0
                                         returnValue = USE_EXISTING_ID;
 186  0
                                         setVisible(false);
 187  0
                                 }
 188  
                         });
 189  
                 }
 190  0
                 return jButtonImport;
 191  
         }
 192  
 
 193  
         /**
 194  
          * This method initializes jButtonNew        
 195  
          *         
 196  
          * @return javax.swing.JButton        
 197  
          */
 198  
         private JButton getJButtonNew() {
 199  0
                 if (jButtonNew == null) {
 200  0
                         jButtonNew = new JButton();
 201  0
                         jButtonNew.setText("Create a new FIBS account");
 202  0
                         jButtonNew.addActionListener(new java.awt.event.ActionListener() {
 203  
                                 public void actionPerformed(java.awt.event.ActionEvent e) {
 204  0
                                         System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
 205  0
                                         returnValue = CREATE_NEW_ACCOUNT;
 206  0
                                         setVisible(false);
 207  0
                                 }
 208  
                         });
 209  
                 }
 210  0
                 return jButtonNew;
 211  
         }
 212  
 
 213  
         /**
 214  
          * This method initializes jButtonCancel        
 215  
          *         
 216  
          * @return javax.swing.JButton        
 217  
          */
 218  
         private JButton getJButtonCancel() {
 219  0
                 if (jButtonCancel == null) {
 220  0
                         jButtonCancel = new JButton();
 221  0
                         jButtonCancel.setText("Do Nothing");
 222  0
                         jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
 223  
                                 public void actionPerformed(java.awt.event.ActionEvent e) {
 224  0
                                         System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
 225  0
                                         returnValue = DO_NOTHING;
 226  0
                                         setVisible(false);
 227  0
                                 }
 228  
                         });
 229  
                 }
 230  0
                 return jButtonCancel;
 231  
         }
 232  
 
 233  
 }  //  @jve:decl-index=0:visual-constraint="10,10"