Source Code Cross Referenced for AskStringDialog.java in  » Report » datavision-1.1.0 » jimm » datavision » gui » 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 » Report » datavision 1.1.0 » jimm.datavision.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package jimm.datavision.gui;
002:
003:        import jimm.util.I18N;
004:        import java.awt.BorderLayout;
005:        import java.awt.event.ActionListener;
006:        import java.awt.event.ActionEvent;
007:        import java.awt.event.WindowAdapter;
008:        import java.awt.event.WindowEvent;
009:        import javax.swing.*;
010:
011:        /**
012:         * A modal dialog used to ask the user for a simple string like a
013:         * formula or parameter name.
014:         *
015:         * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
016:         */
017:        public class AskStringDialog extends JDialog implements  ActionListener {
018:
019:            protected static final int TEXT_FIELD_COLUMNS = 24;
020:
021:            protected String string;
022:            protected JTextField stringField;
023:
024:            /**
025:             * Constructor.
026:             *
027:             * @param frame parent frame
028:             * @param title window title
029:             * @param label string field label
030:             */
031:            public AskStringDialog(java.awt.Frame frame, String title,
032:                    String label) {
033:                this (frame, title, label, "");
034:            }
035:
036:            /**
037:             * Constructor.
038:             *
039:             * @param frame parent frame
040:             * @param title window title
041:             * @param label string field label
042:             * @param initialString initial string value
043:             */
044:            public AskStringDialog(java.awt.Frame frame, String title,
045:                    String label, String initialString) {
046:                super ((java.awt.Frame) null, title, true); // Modal
047:                buildWindow(title, label, initialString);
048:                pack();
049:                setVisible(true);
050:            }
051:
052:            /**
053:             * Returns string (or <code>null</code> if user hit Cancel).
054:             *
055:             * @return string (or <code>null</code> if user cancelled)
056:             */
057:            public String getString() {
058:                return string;
059:            }
060:
061:            /**
062:             * Builds window GUI.
063:             *
064:             * @param title window title
065:             * @param labelString string field label
066:             * @param initialString initial value of string
067:             */
068:            protected void buildWindow(String title, String labelString,
069:                    String initialString) {
070:                getContentPane().setLayout(new BorderLayout());
071:
072:                EditFieldLayout efl = new EditFieldLayout();
073:                stringField = efl.addTextField(labelString, initialString,
074:                        TEXT_FIELD_COLUMNS);
075:
076:                // OK and Cancel buttons
077:                JPanel buttonPanel = new JPanel();
078:                JButton button;
079:
080:                buttonPanel.add(button = new JButton(I18N.get("GUI.ok")));
081:                button.addActionListener(this );
082:                button.setDefaultCapable(true);
083:                getRootPane().setDefaultButton(button);
084:
085:                buttonPanel.add(button = new JButton(I18N.get("GUI.cancel")));
086:                button.addActionListener(this );
087:
088:                getContentPane().add(efl.getPanel(), BorderLayout.CENTER);
089:                getContentPane().add(buttonPanel, BorderLayout.SOUTH);
090:
091:                addWindowListener(new WindowAdapter() {
092:                    public void windowClosing(WindowEvent e) {
093:                        dispose();
094:                    }
095:                });
096:
097:                new FocusSetter(stringField);
098:            }
099:
100:            /**
101:             * Handles the buttons.
102:             *
103:             * @param e action event
104:             */
105:            public void actionPerformed(ActionEvent e) {
106:                String cmd = e.getActionCommand();
107:                if (I18N.get("GUI.ok").equals(cmd)) {
108:                    string = new String(stringField.getText());
109:                    dispose();
110:                } else if (I18N.get("GUI.cancel").equals(cmd)) {
111:                    dispose();
112:                }
113:            }
114:
115:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.