1 package com.bonevich.erj;
2
3 import com.bonevich.erj.ui.Splash;
4 import com.bonevich.erj.ui.ErjFrame;
5 import com.bonevich.erj.app.Application;
6 import com.bonevich.erj.app.Project;
7
8 import org.apache.commons.logging.Log;
9 import org.apache.commons.logging.LogFactory;
10
11 import java.awt.Dimension;
12 import java.awt.Rectangle;
13 import java.awt.event.WindowAdapter;
14 import java.awt.event.WindowEvent;
15
16 /*** The main execution class of ERJ. Creates a splash screen to
17 * present to the user while the application itself is
18 * constructed.
19 */
20 public class Main
21 {
22 private static final Log _logger = LogFactory.getLog(Main.class);
23
24 ////////////////////////////////////////////////////////////////
25 // constructors
26 public Main()
27 {
28 // put up the splash screen and initialize its progress bar
29 Splash splash = new Splash("Starting ERJ...");
30 splash.setVisible(true);
31
32 // create a new Application object
33 splash.showStatus("Creating a new ERJ application...");
34 splash.showProgress(5);
35 Application app = new Application();
36 splash.showProgress(15);
37 app.initDatabaseSupport();
38 splash.showProgress(25);
39 app.initPreferences();
40
41 // set up the ERJ browser
42 splash.showStatus("Setting up ERJ browser");
43 splash.showProgress(40);
44 ErjFrame browser = ErjFrame.getInstance();
45 browser.setApplication(app);
46 browser.init(splash, 50);
47 browser.setSize(ErjConstants.INITIAL_FRAME_SIZE);
48 browser.validate();
49 Dimension dim = browser.getToolkit().getScreenSize();
50 browser.setLocation(
51 dim.width/2 - browser.getWidth()/2,
52 dim.height/2 - browser.getHeight()/2
53 );
54
55 // create a default ERJ project
56 splash.showStatus("Creating a new ERJ project...");
57 splash.showProgress(80);
58 Project project = app.createDefaultProject();
59
60 splash.showStatus("Opening project browser...");
61 splash.showProgress(95);
62 try
63 {
64 Thread.sleep(1000);
65 }
66 catch (Exception e) {}
67 browser.setVisible(true);
68
69 splash.setVisible(false);
70 splash.dispose();
71 splash = null;
72 }
73
74 ////////////////////////////////////////////////////////////////
75 // main
76 public static void main(String args[])
77 {
78 new Main();
79 }
80
81 } /* end class Main */
This page was automatically generated by Maven