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


001:        /*
002:         *  @(#)SplashWindow.java 1.4 01/04/17 16:17:24
003:         *
004:         * Copyright (c) 2000-2001 Sun Microsystems, Inc. All Rights Reserved.
005:         */
006:
007:        package com.db.client;
008:
009:        import java.awt.Graphics;
010:        import java.awt.Dimension;
011:        import java.net.URL;
012:        import java.awt.Image;
013:        import java.awt.Toolkit;
014:        import java.awt.Color;
015:        import java.awt.MediaTracker;
016:        import java.awt.image.BufferedImage;
017:
018:        /**
019:         * A General purpose Splash Window for display while during
020:         * application startup.
021:         *
022:         * The window contains an image and can display text messages to mark
023:         * progress of application startup.
024:         *
025:         * @author  paulby
026:         * @version
027:         */
028:        public class SplashWindow extends javax.swing.JWindow {
029:
030:            private static SplashWindow splashWindow = null;
031:            private SplashPanel panel = null;
032:
033:            /** Creates new SplashWindow
034:             * @param imageResourceName is the name of the image file to display on
035:             * the splash screen in the form of a Java Resource
036:             */
037:            public SplashWindow(final String imageResourceName) {
038:                initComponents();
039:
040:                URL imageURL = this .getClass().getClassLoader().getResource(
041:                        imageResourceName);
042:                Image image = Toolkit.getDefaultToolkit().createImage(imageURL);
043:
044:                Dimension screenDim = Toolkit.getDefaultToolkit()
045:                        .getScreenSize();
046:
047:                MediaTracker tracker = new MediaTracker(this );
048:                tracker.addImage(image, 1);
049:                try {
050:                    tracker.waitForAll();
051:                } catch (InterruptedException e) {
052:                }
053:
054:                panel = new SplashPanel(image);
055:                this .getContentPane().add("Center", panel);
056:                pack();
057:
058:                Dimension windowDim = getPreferredSize();
059:
060:                setLocation(screenDim.width / 2 - windowDim.width / 2,
061:                        screenDim.height / 2 - windowDim.height / 2);
062:            }
063:
064:            /** Creates and show a SplashWindow
065:             * @param imageResourceName is the name of the image file to display on
066:             * the splash screen in the form of a Java Resource
067:             */
068:            public static void showSplashscreen(final String imageResourceName) {
069:                if (splashWindow == null)
070:                    splashWindow = new SplashWindow(imageResourceName);
071:
072:                splashWindow.setVisible(true);
073:            }
074:
075:            /**
076:             * Destroy any locally held resource and hide the window
077:             */
078:            public static void destroySplashscreen() {
079:                splashWindow.setVisible(false);
080:                splashWindow.dispose();
081:                splashWindow = null;
082:            }
083:
084:            /**
085:             * Show this message on the splash screen
086:             */
087:            public static void showMessage(final String message) {
088:                if (splashWindow != null)
089:                    splashWindow.actualShowMessage(message);
090:            }
091:
092:            protected void actualShowMessage(final String message) {
093:                panel.showMessage(message);
094:            }
095:
096:            /** This method is called from within the constructor to
097:             * initialize the form.
098:             * WARNING: Do NOT modify this code. The content of this method is
099:             * always regenerated by the FormEditor.
100:             */
101:            private void initComponents() {//GEN-BEGIN:initComponents
102:                addWindowListener(new java.awt.event.WindowAdapter() {
103:                    public void windowClosing(java.awt.event.WindowEvent evt) {
104:                        exitForm(evt);
105:                    }
106:                });
107:            }//GEN-END:initComponents
108:
109:            /** Exit the Application */
110:            private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
111:                System.exit(0);
112:            }//GEN-LAST:event_exitForm
113:
114:            // Variables declaration - do not modify//GEN-BEGIN:variables
115:            // End of variables declaration//GEN-END:variables
116:
117:            class SplashPanel extends javax.swing.JPanel {
118:                private BufferedImage image;
119:                private BufferedImage messageImage = null;
120:                private String message = "";
121:
122:                private int messageX = 40;
123:                private int messageY = 55;
124:                private int messageH = 20;
125:                private int messageW = 200;
126:                private int ascent;
127:
128:                public SplashPanel(final Image im) {
129:                    int width = im.getWidth(null);
130:                    int height = im.getHeight(null);
131:
132:                    image = new BufferedImage(width, height,
133:                            BufferedImage.TYPE_INT_RGB);
134:                    image.getGraphics().drawImage(im, 0, 0, null);
135:
136:                    Dimension d = new Dimension(width, height);
137:                    setPreferredSize(d);
138:                    setMinimumSize(d);
139:
140:                    ascent = getFontMetrics(getFont()).getMaxAscent();
141:                    messageH = getFontMetrics(getFont()).getMaxDescent()
142:                            + ascent;
143:                    messageW = width - messageX;
144:
145:                    messageImage = image.getSubimage(messageX, messageY
146:                            - ascent, messageW, messageH);
147:                }
148:
149:                public void showMessage(final String message) {
150:                    this .message = message;
151:                    Graphics g = getGraphics();
152:                    g
153:                            .drawImage(messageImage, messageX, messageY
154:                                    - ascent, null);
155:                    g.drawString(message, messageX, messageY);
156:                }
157:
158:                public void paint(Graphics g) {
159:                    g.drawImage(image, 0, 0, null);
160:
161:                    g.drawString(message, messageX, messageY);
162:                }
163:
164:            }
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.