summaryrefslogtreecommitdiffstats
path: root/Master/Agile Software Development/TestApp/src/testapp/App.java
blob: d0e1a55ac528e2aaa191a28df9b10583335a8a35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Main
 */

package testapp;

import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.UIManager;
import java.util.logging.*;

/**
 *
 * @author eisenhauer
 */
public class App {
    
    private static App theInstance = null;
    private JFrame mainFrame = null;
    private String appPath = "";
    private App() {
        try {
            this.appPath = Locate.getClassLocation(this.getClass()).getParent();
            // to run from Netbeans
            if (appPath.contains("build")) {
                appPath = appPath.replace("build", "dist");
            }
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }

    public static App getInstance() {
        if (theInstance == null) {
            theInstance = new App();
        }
        return theInstance;
    }
    private void startApplication() {
        // Setup Look and Feel
        try {
                //UIManager.setLookAndFeel(new com.jgoodies.looks.windows.WindowsLookAndFeel());
        } catch (Exception e) {
                e.printStackTrace();
        }        
        mainFrame = new AppFrame("Webspinne");
        mainFrame.pack();
        mainFrame.setVisible(true);
    }
    public String getAppPath() {
        return appPath;
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        App.getInstance().startApplication();
    }

}