Source Code Cross Referenced for BundleGroupEditDialog.java in  » Internationalization-Localization » RBManager » com » ibm » rbm » 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 » Internationalization Localization » RBManager » com.ibm.rbm.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *****************************************************************************
003:         * Copyright (C) 2000-2004, International Business Machines Corporation and  *
004:         * others. All Rights Reserved.                                              *
005:         *****************************************************************************
006:         */
007:        package com.ibm.rbm.gui;
008:
009:        import java.awt.*;
010:        import java.awt.event.*;
011:
012:        import javax.swing.*;
013:
014:        import com.ibm.rbm.*;
015:
016:        /**
017:         * A dialog which allows the user to create a new Bundle Group
018:         */
019:        class BundleGroupEditDialog extends JDialog {
020:            BundleGroup group;
021:
022:            // Helper data
023:            int left_col_width = 125;
024:            int right_col_width = 275;
025:            int row_height = 25;
026:            Dimension leftDim = new Dimension(left_col_width, row_height);
027:            Dimension rightDim = new Dimension(right_col_width, row_height);
028:
029:            // Components
030:            Box mainBox = new Box(BoxLayout.Y_AXIS);
031:            Box box1 = new Box(BoxLayout.X_AXIS);
032:            Box box2 = new Box(BoxLayout.X_AXIS);
033:            Box box3 = new Box(BoxLayout.X_AXIS);
034:
035:            JLabel nameLabel = new JLabel(Resources
036:                    .getTranslation("dialog_group"));
037:            JLabel commentLabel = new JLabel(Resources
038:                    .getTranslation("dialog_group_comment"));
039:            JTextField nameField = new JTextField("");
040:            JTextField commentField = new JTextField("");
041:            JButton editButton = new JButton(Resources
042:                    .getTranslation("button_edit"));
043:            JButton cancelButton = new JButton(Resources
044:                    .getTranslation("button_cancel"));
045:
046:            public BundleGroupEditDialog(BundleGroup group, JFrame frame,
047:                    String title, boolean modal) {
048:                super (frame, title, modal);
049:                this .group = group;
050:                initComponents();
051:                enableEvents(AWTEvent.KEY_EVENT_MASK);
052:            }
053:
054:            protected void processKeyEvent(KeyEvent ev) {
055:                if (ev.getKeyCode() == KeyEvent.VK_ENTER) {
056:                    boolean success = editGroup();
057:                    if (!success) {
058:                        String alert = Resources
059:                                .getTranslation("error_modify_group");
060:                        JOptionPane.showMessageDialog(this , alert, Resources
061:                                .getTranslation("error_internal"),
062:                                JOptionPane.ERROR_MESSAGE);
063:                    } else {
064:                        setVisible(false);
065:                        dispose();
066:                    }
067:                } else if (ev.getKeyCode() == KeyEvent.VK_CANCEL) {
068:                    closeWindow();
069:                }
070:            }
071:
072:            boolean editGroup() {
073:                if (group == null)
074:                    return false;
075:                group.setName(nameField.getText().trim());
076:                group.setComment(commentField.getText().trim());
077:                return true;
078:            }
079:
080:            private void initComponents() {
081:                // Error check
082:                if (group == null) {
083:                    String alert = Resources
084:                            .getTranslation("error_modify_group");
085:                    JOptionPane.showMessageDialog(this , alert, Resources
086:                            .getTranslation("error_internal"),
087:                            JOptionPane.ERROR_MESSAGE);
088:                    closeWindow();
089:                    return;
090:                }
091:
092:                // Initialize values
093:
094:                // Set up the components
095:                nameLabel.setPreferredSize(leftDim);
096:                nameField.setColumns(30);
097:                commentLabel.setPreferredSize(leftDim);
098:                commentField.setColumns(30);
099:
100:                nameField.setText(group.getName());
101:                commentField.setText(group.getComment());
102:                getRootPane().setDefaultButton(editButton);
103:
104:                box1.add(nameLabel);
105:                box1.add(nameField);
106:                box2.add(commentLabel);
107:                box2.add(commentField);
108:                box3.add(editButton);
109:                box3.add(Box.createHorizontalStrut(5));
110:                box3.add(cancelButton);
111:
112:                // Add the appropriate listeners
113:                cancelButton.addActionListener(new ActionListener() {
114:                    public void actionPerformed(ActionEvent ev) {
115:                        JDialog dialog = (JDialog) ((JButton) ev.getSource())
116:                                .getParent().getParent().getParent()
117:                                .getParent().getParent();
118:                        dialog.setVisible(false);
119:                        dialog.dispose();
120:                    }
121:                });
122:
123:                editButton.addActionListener(new ActionListener() {
124:                    public void actionPerformed(ActionEvent ev) {
125:                        BundleGroupEditDialog dialog = (BundleGroupEditDialog) ((JButton) ev
126:                                .getSource()).getParent().getParent()
127:                                .getParent().getParent().getParent();
128:                        boolean success = dialog.editGroup();
129:                        if (!success) {
130:                            String alert = Resources
131:                                    .getTranslation("error_modify_group");
132:                            JOptionPane.showMessageDialog(dialog, alert,
133:                                    Resources.getTranslation("error_internal"),
134:                                    JOptionPane.ERROR_MESSAGE);
135:                        } else {
136:                            dialog.setVisible(false);
137:                            dialog.dispose();
138:                        }
139:                    }
140:                });
141:
142:                // Complete the initialization of the frame
143:                setLocation(new java.awt.Point(50, 50));
144:                mainBox.removeAll();
145:                mainBox.add(box1);
146:                mainBox.add(Box.createVerticalStrut(5));
147:                mainBox.add(box2);
148:                getContentPane().setLayout(new BorderLayout());
149:                getContentPane().removeAll();
150:                getContentPane().add(mainBox, BorderLayout.CENTER);
151:                getContentPane().add(box3, BorderLayout.SOUTH);
152:                validateTree();
153:                pack();
154:                setVisible(true);
155:                //setResizable(false);
156:            }
157:
158:            void closeWindow() {
159:                setVisible(false);
160:                dispose();
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.