Source Code Cross Referenced for SplashFrame.java in  » Code-Analyzer » findbugs » edu » umd » cs » findbugs » gui2 » 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 » Code Analyzer » findbugs » edu.umd.cs.findbugs.gui2 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * FindBugs - Find Bugs in Java programs
003:         * Copyright (C) 2006, University of Maryland
004:         * 
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         * 
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         * 
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307, USA
018:         */
019:
020:        package edu.umd.cs.findbugs.gui2;
021:
022:        import java.awt.BorderLayout;
023:        import java.awt.Color;
024:        import java.awt.Dimension;
025:        import java.awt.Frame;
026:        import java.awt.Graphics;
027:        import java.awt.Image;
028:        import java.awt.MediaTracker;
029:        import java.awt.Toolkit;
030:
031:        import javax.swing.BorderFactory;
032:        import javax.swing.ImageIcon;
033:        import javax.swing.JLabel;
034:        import javax.swing.JPanel;
035:        import javax.swing.JWindow;
036:
037:        /*
038:         *  If long load times are getting you down, uncomment this class's instantiation in driver 
039:         * and add an extra 4 seconds to your load time, but get to watch a dancing bug for the remainder!
040:         */
041:
042:        public class SplashFrame extends JWindow {
043:
044:            private static Thread animator;
045:
046:            public SplashFrame() {
047:                super (new Frame());
048:
049:                Toolkit toolkit = Toolkit.getDefaultToolkit();
050:                Image image = toolkit.getImage(MainFrame.class
051:                        .getResource("SplashBug1.png"));
052:                Image image2 = toolkit.getImage(MainFrame.class
053:                        .getResource("SplashBug2B.png"));
054:                Image imageReverse = toolkit.getImage(MainFrame.class
055:                        .getResource("SplashBug1reverse.png"));
056:                Image image2Reverse = toolkit.getImage(MainFrame.class
057:                        .getResource("SplashBug2reverseB.png"));
058:
059:                //		JPanel temp = new JPanel(new BorderLayout());
060:                //		temp.setBorder(BorderFactory.createLineBorder(Color.black, 2));
061:                //		setContentPane(temp);
062:                JLabel l = new JLabel(new ImageIcon(MainFrame.class
063:                        .getResource("umdFindbugs.png")));
064:                JPanel p = new JPanel();
065:                Viewer viewer = new Viewer(image, image2, imageReverse,
066:                        image2Reverse);
067:                final JPanel bottom = viewer;
068:                p.setBackground(Color.white);
069:                bottom.setBackground(Color.white);
070:
071:                p.add(l);
072:                getContentPane().add(p, BorderLayout.CENTER);
073:                getContentPane().add(bottom, BorderLayout.SOUTH);
074:                pack();
075:                Dimension screenSize = Toolkit.getDefaultToolkit()
076:                        .getScreenSize();
077:                Dimension labelSize = l.getPreferredSize();
078:                p.setPreferredSize(new Dimension(labelSize.width + 50,
079:                        labelSize.height + 20));
080:                p.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
081:                bottom
082:                        .setBorder(BorderFactory.createLineBorder(Color.BLACK,
083:                                1));
084:                Dimension panelSize = p.getPreferredSize();
085:                bottom.setPreferredSize(new Dimension(panelSize.width, image
086:                        .getHeight(null) + 2));
087:
088:                setLocation(screenSize.width / 2 - (panelSize.width / 2),
089:                        screenSize.height / 2 - (panelSize.height / 2));
090:
091:                //		g.drawImage(new ImageIcon("bugSplash3.png"),0 ,0 ,null);
092:
093:                pack();
094:                screenSize = null;
095:                labelSize = null;
096:                viewer.animate();
097:
098:            }
099:
100:            public static void main(String[] args) {
101:                (new SplashFrame()).setVisible(true);
102:
103:            }
104:
105:            @Override
106:            public void setVisible(boolean b) {
107:                super .setVisible(b);
108:                if (!b)
109:                    animator.interrupt();
110:            }
111:
112:            private static class Viewer extends JPanel {
113:                private Image image;
114:                private Image image2;
115:                private Image imageR;
116:                private Image image2R;
117:                boolean swap = false;
118:                boolean reverse = true;
119:                int callCount = 0;
120:                int xpos = 0;
121:                int ypos = 0;
122:                int farRight;
123:
124:                public Viewer(Image i1, Image i2, Image i1r, Image i2r) {
125:                    image = i1;
126:                    image2 = i2;
127:                    imageR = i1r;
128:                    image2R = i2r;
129:                    MediaTracker mediaTracker = new MediaTracker(this );
130:                    mediaTracker.addImage(image, 0);
131:                    mediaTracker.addImage(image2, 1);
132:                    mediaTracker.addImage(imageR, 2);
133:                    mediaTracker.addImage(image2R, 3);
134:                    try {
135:                        mediaTracker.waitForID(0);
136:                        mediaTracker.waitForID(1);
137:                        mediaTracker.waitForID(2);
138:                        mediaTracker.waitForID(3);
139:                    } catch (InterruptedException ie) {
140:                        System.err.println(ie);
141:                        System.exit(1);
142:                    }
143:                    animator = new Thread(new Runnable() {
144:                        public void run() {
145:                            int deltaX = 1;
146:
147:                            while (true) {
148:                                if (Thread.currentThread().isInterrupted())
149:                                    return;
150:
151:                                callCount++;
152:                                if (callCount == 10) {
153:                                    swap = !swap;
154:                                    callCount = 0;
155:                                }
156:
157:                                xpos += deltaX;
158:                                try {
159:                                    Thread.sleep(20);
160:                                } catch (InterruptedException e) {
161:                                    break;
162:                                }
163:
164:                                if (xpos > Viewer.this .getSize().width
165:                                        - image.getWidth(null)) {
166:                                    deltaX = -1;
167:                                    reverse = !reverse;
168:                                }
169:                                if (xpos < 0) {
170:                                    deltaX = 1;
171:                                    reverse = !reverse;
172:                                }
173:
174:                                Viewer.this .repaint();
175:                            }
176:                        }
177:                    });
178:                }
179:
180:                public void animate() {
181:                    animator.start();
182:                }
183:
184:                @Override
185:                public void setPreferredSize(Dimension d) {
186:                    super .setPreferredSize(d);
187:                }
188:
189:                private Image imageToDraw() {
190:                    if (swap) {
191:                        if (!reverse)
192:                            return image;
193:                        return imageR;
194:                    } else {
195:                        if (!reverse)
196:                            return image2;
197:                        return image2R;
198:                    }
199:                }
200:
201:                @Override
202:                public void paint(Graphics graphics) {
203:                    super .paint(graphics);
204:
205:                    //			graphics.clearRect(0,0,500,500);
206:                    graphics.drawImage(imageToDraw(), xpos, ypos, null);
207:                }
208:            }
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.