Source Code Cross Referenced for DemoJMFJ3DVR.java in  » 6.0-JDK-Modules » java-3d » com » db » media » in » 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 » 6.0 JDK Modules » java 3d » com.db.media.in 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *      @(#)DemoJMFJ3DVR.java 1.0, 1 May 2000
003:         *
004:         * Copyright (c) 2000 Silvere Martin-Michiellot All Rights Reserved.
005:         *
006:         * Silvere Martin-Michiellot grants you ("Licensee") a non-exclusive,
007:         * royalty free, license to use, modify and redistribute this
008:         * software in source and binary code form,
009:         * provided that i) this copyright notice and license appear on all copies of
010:         * the software; and ii) Licensee does not utilize the software in a manner
011:         * which is disparaging to Silvere Martin-Michiellot.
012:         *
013:         * This software is provided "AS IS," without a warranty of any kind. ALL
014:         * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
015:         * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
016:         * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. Silvere Martin-Michiellot
017:         * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
018:         * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
019:         * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
020:         * Silvere Martin-Michiellot OR ITS LICENSORS BE LIABLE
021:         * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
022:         * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
023:         * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
024:         * OR INABILITY TO USE SOFTWARE, EVEN IF Silvere Martin-Michiellot HAS BEEN
025:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
026:         *
027:         * This software is not designed or intended for use in on-line control of
028:         * aircraft, air traffic, aircraft navigation or aircraft communications; or in
029:         * the design, construction, operation or maintenance of any nuclear
030:         * facility. Licensee represents and warrants that it will not use or
031:         * redistribute the Software for such purposes.
032:         *
033:         * @Author: Silvere Martin-Michiellot
034:         *
035:         */
036:
037:        package com.db.media.in;
038:
039:        import javax.media.*;
040:        import javax.media.format.*;
041:        import javax.media.control.*;
042:        import java.awt.*;
043:        import java.awt.event.*;
044:        import java.io.File;
045:        import javax.swing.*;
046:        import javax.media.j3d.*;
047:        import com.sun.j3d.utils.universe.SimpleUniverse;
048:        import com.sun.j3d.utils.geometry.Cylinder;
049:
050:        /*
051:         * This is the demo program to render live video on a 3D cylinder
052:         * surface
053:         */
054:
055:        public class DemoJMFJ3DVR extends JFrame implements  ActionListener {
056:
057:            private JMenuItem printItem;
058:            private JMenuItem saveItem;
059:            private JMenuItem quitItem;
060:
061:            private Canvas3D canvas3D;
062:
063:            private SimpleUniverse simpleUniverse;
064:
065:            private class AppPanel extends JPanel {
066:
067:                public BranchGroup createSceneGraph(String args[]) {
068:                    // Create the root of the branch graph
069:
070:                    BranchGroup objRoot;
071:
072:                    objRoot = new BranchGroup();
073:                    //this is the place you have to put your code to
074:                    //DISPLAY SOMETHING in the Canvas3D
075:
076:                    return objRoot;
077:
078:                }
079:
080:                // Create the Canvas3D (both on-screen and off-screen)
081:                private void createCanvas3D(String[] args) {
082:
083:                    String url = null;
084:                    boolean dc = true;
085:                    J3DVideoRenderer j3DVideoRenderer;
086:
087:                    // Create Canvas3D
088:                    GraphicsConfiguration config = SimpleUniverse
089:                            .getPreferredConfiguration();
090:
091:                    canvas3D = new Canvas3D(config);
092:                    canvas3D.setSize(600, 450);
093:
094:                    // Create a simple scene and attach it to the virtual universe
095:                    BranchGroup scene = createSceneGraph(args);
096:                    simpleUniverse = new SimpleUniverse(canvas3D);
097:                    // This will move the ViewPlatform back a bit so the
098:                    // objects in the scene can be viewed.
099:                    simpleUniverse.getViewingPlatform()
100:                            .setNominalViewingTransform();
101:                    simpleUniverse.addBranchGraph(scene);
102:
103:                    BranchGroup objects = new BranchGroup();
104:
105:                    //create a new appearance on a surface
106:                    Appearance appearance = new Appearance();
107:                    Cylinder cyl = new Cylinder(0.5f, 2.0f, appearance);
108:                    objects.addChild(cyl);
109:
110:                    simpleUniverse.addBranchGraph(objects);
111:
112:                    int i = 0;
113:
114:                    while (i < args.length) {
115:                        if (args[i].equals("-m")) {
116:                            i++;
117:                            if (i >= args.length) {
118:                                printUsage();
119:                                System.exit(0);
120:                            }
121:
122:                            url = args[i];
123:
124:                            if (!(url.startsWith("file:") || url
125:                                    .startsWith("http:"))) {
126:                                url = "file:" + url;
127:                            }
128:                        } else if (args[i].equals("-c")) {
129:                            i++;
130:                            if (i >= args.length) {
131:                                printUsage();
132:                                System.exit(0);
133:                            }
134:
135:                            dc = new Boolean(args[i]).booleanValue();
136:                        }
137:                        i++;
138:                    }
139:
140:                    if (url == null) {
141:                        try {
142:                            Class cls = Class.forName("DemoJMFJ3DVR");
143:                            url = cls.getResource("Behfar.mov").toString();
144:                        } catch (Exception ex) {
145:                            ex.printStackTrace();
146:                        }
147:                    }
148:
149:                    System.out.println("url = " + url);
150:
151:                    setLayout(new BorderLayout());
152:
153:                    j3DVideoRenderer = new J3DVideoRenderer(url, canvas3D,
154:                            appearance);
155:                    System.out.println("video processor start");
156:
157:                }
158:
159:                private AppPanel(String args[]) {
160:                    setLayout(new BorderLayout());
161:
162:                    // Create Canvas3D and scene graph
163:                    createCanvas3D(args);
164:                    add("Center", canvas3D);
165:                }
166:
167:            }
168:
169:            public void actionPerformed(ActionEvent event) {
170:
171:                Object target = event.getSource();
172:
173:                if (target == quitItem) {
174:                    simpleUniverse.removeAllLocales();
175:                    System.exit(0);
176:                }
177:
178:            }
179:
180:            private JMenuBar createMenuBar() {
181:
182:                JMenuBar menuBar = new JMenuBar();
183:                JMenu fileMenu = new JMenu("File");
184:                quitItem = new JMenuItem("Quit");
185:                quitItem.addActionListener(this );
186:                fileMenu.add(quitItem);
187:                menuBar.add(fileMenu);
188:
189:                return menuBar;
190:
191:            }
192:
193:            private DemoJMFJ3DVR(String args[]) {
194:
195:                this .setTitle("Canvas3D Video Test");
196:
197:                // Create and initialize menu bar
198:                JPopupMenu.setDefaultLightWeightPopupEnabled(false);
199:                this .setJMenuBar(createMenuBar());
200:
201:                // Handle the close event
202:                this .addWindowListener(new WindowAdapter() {
203:                    public void windowClosing(WindowEvent winEvent) {
204:                        System.exit(0);
205:                    }
206:                });
207:
208:                // Add main panel to top-level frame and make it visible
209:                this .getContentPane().add(new AppPanel(args));
210:                this .pack();
211:                this .setVisible(true);
212:
213:            }
214:
215:            public static void main(String[] args) {
216:
217:                new DemoJMFJ3DVR(args);
218:
219:            }
220:
221:            public static void printUsage() {
222:
223:                System.out.println("java DemoJMFJ3DVR [-m <url-of-the-movie>]");
224:                System.out
225:                        .println("e.g. java DemoJMFJ3DVR -m file:/home/media/video/gun.mov");
226:
227:            }
228:
229:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.