01: /*
02: * The contents of this file are subject to the Mozilla Public License
03: * Version 1.1 (the "License"); you may not use this file except in
04: * compliance with the License. You may obtain a copy of the License at
05: * http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
09: * License for the specific language governing rights and limitations
10: * under the License.
11: *
12: * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
13: *
14: * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
15: * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
16: *
17: * Contributor(s):
18: * Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
19: *
20: * If you didn't download this code from the following link, you should check
21: * if you aren't using an obsolete version: http://www.isqlviewer.com
22: */
23: package org.isqlviewer.ui;
24:
25: import javax.swing.UIManager;
26:
27: import org.isqlviewer.sql.embedded.EmbeddedDatabase;
28: import org.isqlviewer.swing.SwingUtilities;
29:
30: /**
31: * @author Mark A. Kobold <mkobold at isqlviewer dot com>
32: * @version 1.0
33: */
34: public class SwingLauncher {
35:
36: public static void main(String[] args) {
37:
38: int status = handCMDLine(args);
39: if (status != 0) {
40: System.exit(status);
41: }
42:
43: if (SwingUtilities.isMacOS()) {
44: if (!Boolean.getBoolean("apple.laf.useScreenMenuBar")) {
45: System
46: .setProperty("apple.laf.useScreenMenuBar",
47: "true");
48: }
49: }
50: try {
51: UIManager.setLookAndFeel(UIManager
52: .getSystemLookAndFeelClassName());
53: } catch (Throwable error) {
54: error.printStackTrace();
55: return;
56: }
57: // ensure that the embedded database driver is available //
58: EmbeddedDatabase.getSharedInstance();
59: ApplicationFrame frame = new ApplicationFrame();
60: frame.setVisible(true);
61: }
62:
63: private static int handCMDLine(String[] args) {
64:
65: if (args.length >= 1) {
66: for (int i = 0; i < args.length; i++) {
67: String arg = args[i];
68: if (arg.startsWith("-h")) {
69: return 0;
70: } else if (arg.startsWith("-v")) {
71: return 0;
72: } else {
73: return 0;
74: }
75: }
76: }
77: return 0;
78: }
79: }
|