Source code: com/jdwsoftware/wfh/control/Main.java
1 package com.jdwsoftware.wfh.control;
2
3 import javax.swing.UIManager;
4 import java.awt.*;
5
6 /**
7 * <p><b>Title</b>: Woody's Fishing Hole</p>
8 * <p><b>Description</b>: Educational Fishing Game</p>
9 * <p><b>Copyright</b>: Copyright (C) 2003 JDW Software, LLC</p>
10 * <p><b>Company</b>: JDW Software, LLC</p>
11 * <p>Default main, just create a new MainFrame</p>
12 *
13 * @author <a href="mailto:jdw@jdwsoftware.com">Jim Woodgate</a>
14 * @version $Revision: 1.5 $
15 */
16
17 /*
18 * This file is part of Woodys Fishing Hole.
19 *
20 * Woodys Fishing Hole is free software; you can redistribute it
21 * and/or modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version 2 of
23 * the License, or (at your option) any later version.
24 *
25 * Woodys Fishing Hole is distributed in the hope that it will be
26 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
27 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with Woodys Fishing Hole; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
33 * USA
34 */
35
36 public class Main {
37 private static final String COPYRIGHT = com.jdwsoftware.util.Copyright.COPYRIGHT;
38 private static final String VERSION = "$Id: Main.java,v 1.5 2003/11/22 03:47:15 jdw Exp $";
39
40 boolean packFrame = false;
41
42 //Construct the application
43 public Main() {
44 System.out.println("\n\nWoody's Fishing Hole\nCopyright (C) 2003 JDW Software, LLC\n");
45
46 MainFrame frame = new MainFrame();
47 //Validate frames that have preset sizes
48 //Pack frames that have useful preferred size info, e.g. from their layout
49 if (packFrame) {
50 frame.pack();
51 }
52 else {
53 frame.validate();
54 }
55 //Center the window
56 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
57 Dimension frameSize = frame.getSize();
58 if (frameSize.height > screenSize.height) {
59 frameSize.height = screenSize.height;
60 }
61 if (frameSize.width > screenSize.width) {
62 frameSize.width = screenSize.width;
63 }
64 frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
65 frame.setVisible(true);
66 }
67 //Main method
68 public static void main(String[] args) {
69 try {
70 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
71 }
72 catch(Exception e) {
73 e.printStackTrace();
74 }
75 new Main();
76 }
77 }