Source Code Cross Referenced for ProgressDialog.java in  » Database-Client » DBBrowser » org » dbbrowser » ui » widget » 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 » Database Client » DBBrowser » org.dbbrowser.ui.widget 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.dbbrowser.ui.widget;
002:
003:        import java.awt.FlowLayout;
004:        import java.awt.event.WindowAdapter;
005:        import java.awt.event.WindowEvent;
006:        import javax.swing.JDialog;
007:        import javax.swing.JFrame;
008:        import javax.swing.JLabel;
009:        import javax.swing.JProgressBar;
010:        import javax.swing.event.ChangeEvent;
011:        import javax.swing.event.ChangeListener;
012:        import org.dbbrowser.ui.UIControllerForQueries;
013:
014:        /**
015:         * A dialog which shows the progress of a task and some label
016:         */
017:        public class ProgressDialog implements  ChangeListener {
018:            private static final long serialVersionUID = UIControllerForQueries.version;
019:
020:            private String title = "";
021:            private String textForLabel = "";
022:            private JDialog frame = null;
023:            private JProgressBar aProgressBar = null;
024:            private JLabel label = null;
025:            private Integer minValue = null;
026:            private Integer maxValue = null;
027:
028:            /**
029:             * Constructer
030:             * @param title
031:             * @param textForLabel
032:             * @param minValue
033:             * @param maxValue
034:             */
035:            public ProgressDialog(String title, String textForLabel,
036:                    Integer minValue, Integer maxValue) {
037:                this .title = title;
038:                this .textForLabel = textForLabel;
039:                this .minValue = minValue;
040:                this .maxValue = maxValue;
041:                initialize();
042:            }
043:
044:            private void initialize() {
045:                //Setup the frame
046:                this .frame = new JDialog();
047:                this .frame.setTitle(this .title);
048:                this .frame.setResizable(false);
049:                this .frame.getContentPane().setLayout(new FlowLayout());
050:                this .frame.setSize(300, 100);
051:                this .frame.setLocationRelativeTo(null);
052:                this .frame
053:                        .addWindowFocusListener(new ProgressDialogWindowAdapter());
054:                this .frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
055:
056:                //Setup the progress bar
057:                aProgressBar = new JProgressBar(this .minValue.intValue(),
058:                        this .maxValue.intValue());
059:                aProgressBar.setValue(this .minValue.intValue());
060:                aProgressBar.setStringPainted(true);
061:
062:                //Set the label
063:                this .label = new JLabel(this .textForLabel);
064:
065:                //Add the widgets
066:                this .frame.getContentPane().add(this .aProgressBar);
067:                this .frame.getContentPane().add(this .label);
068:            }
069:
070:            /**
071:             * Returns the maximum value for the progress of the task
072:             * @return
073:             */
074:            public Integer getMaxValue() {
075:                return this .maxValue;
076:            }
077:
078:            /**
079:             * Returns the starting(min) value
080:             * @return
081:             */
082:            public Integer getMinValue() {
083:                return this .minValue;
084:            }
085:
086:            /**
087:             * Call this method to set the value during the progress of the task.
088:             * @param newValue
089:             */
090:            public void setValue(Integer newValue) {
091:                this .aProgressBar.setValue(newValue.intValue());
092:            }
093:
094:            /**
095:             * Set to true to make it an indeterminate progress bar
096:             * @param b
097:             */
098:            public void setIndeterminate(boolean b) {
099:                this .aProgressBar.setIndeterminate(b);
100:            }
101:
102:            /**
103:             * Set true if you want to see the labels
104:             * @param b
105:             */
106:            public void setStringPainted(boolean b) {
107:                this .aProgressBar.setStringPainted(b);
108:            }
109:
110:            /**
111:             * Call this during the progress of the task.  This calls setValue as well.  Call this method if it is a determinate progress bar
112:             * @param e
113:             */
114:            public void stateChanged(ChangeEvent e) {
115:                int progress = ((Integer) e.getSource()).intValue();
116:                this .aProgressBar.setValue(progress);
117:            }
118:
119:            /**
120:             * Shows the progress bar
121:             */
122:            public void show() {
123:                this .frame.show();
124:            }
125:
126:            /**
127:             * Call this method to close the progress bar when the task is completed
128:             */
129:            public void close() {
130:                this .frame.pack();
131:                this .frame.dispose();
132:            }
133:
134:            private class ProgressDialogWindowAdapter extends WindowAdapter {
135:                public void windowLostFocus(WindowEvent e) {
136:                    frame.toFront();
137:                }
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.