Source Code Cross Referenced for MarsRoverViewerApp.java in  » IDE-Netbeans » java » MarsRoverViewer » 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 » IDE Netbeans » java » MarsRoverViewer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2007, Sun Microsystems, Inc.
003:         * All rights reserved.
004:         * 
005:         * Redistribution and use in source and binary forms, with or without 
006:         * modification, are permitted provided that the following conditions are met:
007:         * 
008:         *  * Redistributions of source code must retain the above copyright notice, 
009:         *    this list of conditions and the following disclaimer.
010:         *  * Redistributions in binary form must reproduce the above copyright 
011:         *    notice, this list of conditions and the following disclaimer in 
012:         *    the documentation and/or other materials provided with the distribution.
013:         *  * Neither the name of Sun Microsystems, Inc. nor the names of its 
014:         *    contributors may be used to endorse or promote products derived 
015:         *    from this software without specific prior written permission.
016:         *
017:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
018:         * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
019:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
020:         * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
021:         * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
022:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
023:         * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
024:         * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
025:         * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
026:         * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027:         * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
028:         
029:
030:        /*
031:         * MarsRoverViewerApp.java
032:         */
033:
034:        package marsroverviewer;
035:
036:        import java.awt.event.ActionEvent;
037:        import java.net.MalformedURLException;
038:        import java.net.URL;
039:        import java.util.ArrayList;
040:        import java.util.List;
041:        import java.util.logging.Level;
042:        import java.util.logging.Logger;
043:        import javax.swing.Action;
044:        import org.jdesktop.application.Application;
045:        import org.jdesktop.application.SingleFrameApplication;
046:
047:        /**
048:         * This example highlights the importance of background tasks by
049:         * downloading some very large Mars rover images from JPL's
050:         * photojournal web site.  There are about a dozen images, most with
051:         * 10-15M pixels.  Clicking the next/prev buttons (or control-N,P)
052:         * cancels the current download and starts loading a new image.  The
053:         * stop button also cancels the current download.  The list of images
054:         * is defined in the startup() method.  The first image is shown by
055:         * the application's ready() method.
056:         * <p>
057:         * More images of Mars can be found here: 
058:         * <a href="http://photojournal.jpl.nasa.gov/target/Mars">
059:         * http://photojournal.jpl.nasa.gov/target/Mars</a>.  Some of the
060:         * MER images are quite large (like this 22348x4487 whopper,
061:         * http://photojournal.jpl.nasa.gov/jpeg/PIA06917.jpg) and can't
062:         * be loaded without reconfiguring the Java heap parameters.
063:         * <p>
064:         * This file contains the main class of the application. It extends the 
065:         * Swing Application Framework's {@code SingleFrameApplication} class 
066:         * and therefore takes care or simplifies things like 
067:         * loading resources and saving the session state.
068:         *
069:         * This class calls the {@code MarsRoverViewerView} class, which 
070:         * contains the code for constructing the user interface and 
071:         * much of the application logic.
072:         * 
073:         */
074:        public class MarsRoverViewerApp extends SingleFrameApplication {
075:
076:            /**
077:             * At startup create and show the main frame of the application.
078:             */
079:            @Override
080:            protected void startup() {
081:                // create URLs for a set of selected images
082:                String imageDir = "http://photojournal.jpl.nasa.gov/jpeg/";
083:                String[] imageNames = { "PIA03171", "PIA02652", "PIA05108",
084:                        "PIA02696", "PIA05049", "PIA05460", "PIA07327",
085:                        "PIA05117", "PIA05199", "PIA05990", "PIA03623" };
086:                List<URL> imageLocations = new ArrayList<URL>(imageNames.length);
087:                for (String imageName : imageNames) {
088:                    String path = imageDir + imageName + ".jpg";
089:                    try {
090:                        URL url = new URL(path);
091:                        imageLocations.add(url);
092:                    } catch (MalformedURLException e) {
093:                        Logger.getLogger(MarsRoverViewerApp.class.getName())
094:                                .log(Level.WARNING, "bad image URL " + path, e);
095:                    }
096:                }
097:                // create and show the application's main window
098:                show(new MarsRoverViewerView(this , imageLocations));
099:            }
100:
101:            /**
102:             * Runs after the startup has completed and the GUI is up and ready.
103:             * We show the first image here, rather than initializing it at startup
104:             * time, so loading the first image doesn't impede getting the 
105:             * GUI visible.
106:             */
107:            @Override
108:            protected void ready() {
109:                Action refreshAction = getContext().getActionMap(
110:                        MarsRoverViewerView.class, getMainView()).get(
111:                        "refreshImage");
112:                refreshAction.actionPerformed(new ActionEvent(this ,
113:                        ActionEvent.ACTION_PERFORMED, ""));
114:            }
115:
116:            /**
117:             * This method is to initialize the specified window by injecting resources.
118:             * Windows shown in our application come fully initialized from the GUI
119:             * builder, so this additional configuration is not needed.
120:             */
121:            @Override
122:            protected void configureWindow(java.awt.Window root) {
123:            }
124:
125:            /**
126:             * A convenient static getter for the application instance.
127:             * @return the instance of MarsRoverViewerApp
128:             */
129:            public static MarsRoverViewerApp getApplication() {
130:                return Application.getInstance(MarsRoverViewerApp.class);
131:            }
132:
133:            /**
134:             * Main method launching the application.
135:             */
136:            public static void main(String[] args) {
137:                launch(MarsRoverViewerApp.class, args);
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.