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


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