1 /****************************************************************************** 2 * Main.java - Start me up 3 * $Id$ 4 * 5 * BuckoFIBS - Backgammon by BuckoSoft 6 * Copyright© 2009,2010 - Dick Balaska - BuckoSoft, Corp. 7 * 8 * $Log$ 9 * Revision 1.7 2011/06/13 04:40:09 dick 10 * Use Version in a static manner. 11 * 12 * Revision 1.6 2011/05/21 05:28:51 dick 13 * The constructor is private. 14 * 15 * Revision 1.5 2011/05/10 16:08:20 dick 16 * Fix the javadoc pointers to the source code. 17 * 18 * Revision 1.4 2010/09/05 04:08:08 dick 19 * Version has to be a instantiated class. 20 * 21 * Revision 1.3 2010/03/03 13:12:21 inim 22 * Replaced (c) sign in comment mangled by CVS default encoding back to UTF-8 23 * 24 * Revision 1.2 2010/03/03 12:19:49 inim 25 * 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. 26 * 27 * Revision 1.1 2010/02/04 05:57:53 inim 28 * Mavenized project folder layout 29 * 30 * Revision 1.7 2009/02/14 13:15:43 dick 31 * BuckoFIBS is released under the GNU license. 32 * 33 * Revision 1.6 2009/02/13 07:08:18 dick 34 * If there is a --version on the command line, just output the version and exit. 35 * 36 * Revision 1.5 2009/01/28 02:58:18 dick 37 * Javadoc. 38 * 39 * Revision 1.4 2009/01/18 06:17:56 dick 40 * Make the constructor protected for prettier Javadoc. 41 * 42 * Revision 1.3 2009/01/18 04:53:09 dick 43 * MainDialog needs the CommandDispatcher sent to it. 44 * 45 * Revision 1.2 2008/12/11 08:28:29 dick 46 * Javadoc. 47 * 48 * Revision 1.1 2008/03/30 05:41:29 dick 49 * Main moved from BuckoFIBS.gui to BuckoFIBS. 50 * 51 * Revision 1.1 2008/03/29 08:57:43 dick 52 * BuckoFIBS skeleton checkin. 53 */ 54 55 /* 56 * This program is free software: you can redistribute it and/or modify 57 * it under the terms of the GNU General Public License as published by 58 * the Free Software Foundation, either version 3 of the License, or 59 * (at your option) any later version. 60 * 61 * This program is distributed in the hope that it will be useful, 62 * but WITHOUT ANY WARRANTY; without even the implied warranty of 63 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 64 * GNU General Public License for more details. 65 * 66 * You should have received a copy of the GNU General Public License 67 * along with this program. If not, see <http://www.gnu.org/licenses/>. 68 * 69 * The Original Code is BuckoFIBS, <http://www.buckosoft.com/BuckoFIBS/>. 70 * The Initial Developer of the Original Code is Dick Balaska and BuckoSoft, Corp. 71 * 72 */ 73 package com.buckosoft.fibs.BuckoFIBS; 74 75 import com.buckosoft.fibs.BuckoFIBS.gui.MainDialog; 76 import com.buckosoft.fibs.BuckoFIBS.gui.account.ConnectToServerDialog; 77 import com.buckosoft.fibs.BuckoFIBS.gui.account.CreateAccountDialog; 78 import com.buckosoft.fibs.BuckoFIBS.gui.account.NewbieDialog; 79 80 /** Start me up. 81 * @author Dick Balaska 82 * @since 2008/03/29 83 * @version $Revision$ <br> $Date$ 84 * @see <a href="http://cvs.buckosoft.com/Projects/BuckoFIBS/BuckoFIBS/src/main/java/com/buckosoft/fibs/BuckoFIBS/Main.java">cvs Main.java</a> 85 */ 86 public class Main { 87 88 /** Do not instantiate. */ 89 private Main() {} 90 91 private static void createAndShowGUI() { 92 BFProperties properties = new BFProperties(); 93 CommandDispatcher commandDispatcher = new CommandDispatcherImpl(); 94 MainDialog mainDialog = new MainDialog(properties, commandDispatcher); 95 mainDialog.setVisible(true); 96 if (properties.isNewbie()) { 97 commandDispatcher.writeSystemMessageln("Welcome newbie"); 98 NewbieDialog nd = new NewbieDialog(mainDialog); 99 nd.setVisible(true); 100 System.out.println("Back from dialog: return = " + nd.getReturnValue()); 101 if (nd.getReturnValue() == NewbieDialog.CREATE_NEW_ACCOUNT) { 102 CreateAccountDialog cad = new CreateAccountDialog(mainDialog, commandDispatcher); 103 cad.setVisible(true); 104 return; 105 } else if (nd.getReturnValue() == NewbieDialog.USE_EXISTING_ID) { 106 ConnectToServerDialog ctsd = new ConnectToServerDialog(mainDialog, commandDispatcher); 107 ctsd.setVisible(true); 108 return; 109 } 110 } 111 112 } 113 /** main entry point into the application 114 * @param args --version Display the version and exit. 115 */ 116 public static void main(String[] args) { 117 if (args.length > 0 && args[0].equals("--version")) { 118 System.out.print(Version.getVersion()); 119 return; 120 } 121 javax.swing.SwingUtilities.invokeLater(new Runnable() { 122 public void run() { 123 createAndShowGUI(); 124 } 125 }); 126 } 127 128 129 }