Source Code Cross Referenced for OpenJX.java in  » Swing-Library » OpenJX » org » openjx » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » OpenJX » org.openjx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2007 Jared Alexander Spigner
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2.1 of the License, or any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
017:         *
018:         * jspigner@openjx.org
019:         * 
020:         * OpenJX.java
021:         *
022:         * Created on June 7, 2007, 11:44 PM
023:         *
024:         */
025:
026:        package org.openjx;
027:
028:        import javax.swing.JOptionPane;
029:
030:        import org.openjx.display.JXMessageBox;
031:        import org.openjx.display.JXViewer;
032:
033:        import org.openjx.core.VirtualMachine;
034:
035:        /**
036:         * This is the main class for the OpenJX virtual machine.  It handles the
037:         * initial setup and execution of the virtual machine.
038:         *
039:         * @author Jared Spigner
040:         */
041:        public class OpenJX extends JXViewer {
042:
043:            /** This is the identifier of the class. */
044:            private static final long serialVersionUID = 1999L;
045:
046:            /** 
047:             * This is the base name of the application, no prefix or suffix included. 
048:             */
049:            private String applicationName;
050:
051:            /** This is the mode of operation (desktop or applet) application. */
052:            public String applicationMode = "desktop";
053:
054:            /**
055:             * This is a reference to the Virtual Machine.
056:             */
057:            private VirtualMachine virtualMachine;
058:
059:            /**
060:             * This is the main method to the OpenJX application.  It is only used
061:             * when OpenJX is to be run as an application.  It instantiates the class
062:             * with the command line argument array.
063:             *
064:             * @param argv is an array of command line arguments to the application.
065:             */
066:            public static void main(String[] argv) {
067:                OpenJX openJX = new OpenJX(argv);
068:            }
069:
070:            /**
071:             * This is the main method to the OpenJX applet.  It is only used when
072:             * OpenJX is to be run as an applet.  It instantiates the class with the
073:             * applet parameters.
074:             */
075:            public void init() {
076:                String[] argv = new String[2];
077:
078:                argv[0] = "-a" + this .getParameter("applicationName");
079:                argv[1] = "-m" + "applet";
080:
081:                this .executeJX(argv);
082:            }
083:
084:            /** 
085:             * This is the constructor for the OpenJX application.
086:             */
087:            public OpenJX() {
088:            }
089:
090:            /** 
091:             * This is the constructor for the OpenJX application.  It creates a new 
092:             * instance of OpenJX based on the argument array passed to it.
093:             *
094:             * @param argv is an array of command line arguments to the application.
095:             */
096:            public OpenJX(String[] argv) {
097:                this .executeJX(argv);
098:            }
099:
100:            /** 
101:             * This is called by the constructor for the OpenJX application.  
102:             * It creates a new instance of OpenJX based on the argument array passed 
103:             * to it.
104:             *
105:             * @param argv is an array of command line arguments to the application.
106:             */
107:            public void executeJX(String[] argv) {
108:                this .applicationName = "";
109:                this .applicationMode = "";
110:
111:                this .parseArguments(argv);
112:
113:                this .virtualMachine = new VirtualMachine();
114:                this .virtualMachine.setViewer(this );
115:                this .virtualMachine.setApplicationFile(this .applicationName
116:                        + ".jx");
117:
118:                if (!this .virtualMachine.parsePlugins()) {
119:                    System.exit(0);
120:                }
121:
122:                if (!this .virtualMachine.loadPlugins()) {
123:                    System.exit(0);
124:                }
125:
126:                if (!this .virtualMachine.parseProgram()) {
127:                    System.exit(0);
128:                }
129:
130:                if (!this .virtualMachine.compileProgram()) {
131:                    System.exit(0);
132:                }
133:
134:                if (!this .displayMode(this .applicationMode)) {
135:                    System.exit(0);
136:                }
137:
138:                if (!this .virtualMachine.interpretProgram()) {
139:                    System.exit(0);
140:                }
141:
142:                if (!this .virtualMachine.displayProgram(this , 1)) {
143:                    System.exit(0);
144:                }
145:            }
146:
147:            /**
148:             * This method parses the command line arguments and test for missing
149:             * required arguments.  If any are missing it calls the printUsage method
150:             * and then exits the application.
151:             *
152:             * @param argv is an array of command line arguments to the application.
153:             */
154:            public void parseArguments(String[] argv) {
155:                for (int x = 0; x < argv.length; x++) {
156:                    char args[] = argv[x].toCharArray();
157:
158:                    if (args[0] == '-' && args[1] != 0) {
159:                        switch (args[1]) {
160:                        case 'a':
161:                            this .applicationName = argv[x].substring(2, argv[x]
162:                                    .length());
163:                            break;
164:                        case 'p':
165:                            break;
166:                        case 'j':
167:                            break;
168:                        case 'm':
169:                            this .applicationMode = argv[x].substring(2, argv[x]
170:                                    .length());
171:                            break;
172:                        default:
173:                            this .printUsage();
174:                            System.exit(0);
175:                        }
176:                    }
177:                }
178:
179:                if (this .applicationName.equals("")) {
180:                    this .printUsage();
181:                    System.exit(0);
182:                }
183:            }
184:
185:            public void printUsage() {
186:                System.out
187:                        .println("usage ./java -jar OpenJX.jar -a[applicationName] -m[mode(desktop|applet default:desktop)]");
188:            }
189:
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.