Source Code Cross Referenced for FormCustomEditorAdvanced.java in  » IDE-Netbeans » form » OpenForm » 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 » IDE Netbeans » form » OpenForm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        /*
043:         * FormCustomEditorAdvanced.java
044:         *
045:         * Created on February 26, 2001, 1:06 PM
046:         */
047:
048:        package org.netbeans.modules.form;
049:
050:        /**
051:         *
052:         * @author  Ian Formanek, Vladimir Zboril
053:         */
054:        public class FormCustomEditorAdvanced extends javax.swing.JPanel {
055:
056:            static final int DEFAULT_WIDTH = 350;
057:            static final int DEFAULT_HEIGHT = 300;
058:
059:            static final long serialVersionUID = -885210213146017493L;
060:
061:            /** Creates new form FormCustomEditorAdvanced */
062:            public FormCustomEditorAdvanced(String preCode, String postCode) {
063:                initComponents();
064:                preCheckBox.setText(FormUtils
065:                        .getBundleString("CTL_GeneratePreInitializationCode")); // NOI18N
066:                postCheckBox.setText(FormUtils
067:                        .getBundleString("CTL_GeneratePostInitializationCode")); // NOI18N
068:                preCheckBox.setMnemonic(FormUtils.getBundleString(
069:                        "CTL_GeneratePreInitializationCode_Mnemonic") // NOI18N
070:                        .charAt(0));
071:                postCheckBox.setMnemonic(FormUtils.getBundleString(
072:                        "CTL_GeneratePostInitializationCode_Mnemonic") // NOI18N
073:                        .charAt(0));
074:                preEditorPane.setContentType("text/x-java"); // allow syntax coloring // NOI18N
075:                postEditorPane.setContentType("text/x-java"); // allow syntax coloring // NOI18N
076:
077:                // restore state according to parameters
078:                preCheckBox.setSelected(preCode != null);
079:                postCheckBox.setSelected(postCode != null);
080:
081:                // restore current pre/post code, if set
082:                if (preCode != null)
083:                    preEditorPane.setText(preCode);
084:                if (postCode != null)
085:                    postEditorPane.setText(postCode);
086:
087:                org.openide.util.HelpCtx.setHelpIDString(this ,
088:                        "gui.source.modifying.property"); // NOI18N
089:
090:                preEditorPane.setEnabled(preCode != null);
091:                postEditorPane.setEnabled(postCode != null);
092:
093:                // cursors (carets) must be hidden explicitely in some situations
094:                preEditorPane.getCaret().setVisible(
095:                        preCheckBox.isSelected() && preEditorPane.hasFocus());
096:                postEditorPane.getCaret().setVisible(
097:                        postCheckBox.isSelected() && postEditorPane.hasFocus());
098:
099:                preEditorPane.getAccessibleContext().setAccessibleName(
100:                        preCheckBox.getText());
101:                postEditorPane.getAccessibleContext().setAccessibleName(
102:                        postCheckBox.getText());
103:
104:                preCheckBox
105:                        .getAccessibleContext()
106:                        .setAccessibleDescription(
107:                                FormUtils
108:                                        .getBundleString("ACSD_CTL_GeneratePreInitializationCode")); // NOI18N
109:                postCheckBox
110:                        .getAccessibleContext()
111:                        .setAccessibleDescription(
112:                                FormUtils
113:                                        .getBundleString("ACSD_CTL_GeneratePostInitializationCode")); // NOI18N
114:                preEditorPane
115:                        .getAccessibleContext()
116:                        .setAccessibleDescription(
117:                                FormUtils
118:                                        .getBundleString("ACSD_CTL_GeneratePreInitializationCodeArea")); // NOI18N
119:                postEditorPane
120:                        .getAccessibleContext()
121:                        .setAccessibleDescription(
122:                                FormUtils
123:                                        .getBundleString("ACSD_CTL_GeneratePostInitializationCodeArea")); // NOI18N
124:                getAccessibleContext()
125:                        .setAccessibleDescription(
126:                                FormUtils
127:                                        .getBundleString("ACSD_FormCustomEditorAdvanced")); // NOI18N
128:            }
129:
130:            String getPreCode() {
131:                if (!preCheckBox.isSelected())
132:                    return null;
133:                if ("".equals(preEditorPane.getText()))
134:                    return null; // NOI18N
135:                return preEditorPane.getText();
136:            }
137:
138:            String getPostCode() {
139:                if (!postCheckBox.isSelected())
140:                    return null;
141:                if ("".equals(postEditorPane.getText()))
142:                    return null; // NOI18N
143:                return postEditorPane.getText();
144:            }
145:
146:            public java.awt.Dimension getPreferredSize() {
147:                java.awt.Dimension inh = super .getPreferredSize();
148:                return new java.awt.Dimension(Math
149:                        .max(inh.width, DEFAULT_WIDTH), Math.max(inh.height,
150:                        DEFAULT_HEIGHT));
151:            }
152:
153:            /** This method is called from within the constructor to
154:             * initialize the form.
155:             * WARNING: Do NOT modify this code. The content of this method is
156:             * always regenerated by the Form Editor.
157:             */
158:            private void initComponents() {//GEN-BEGIN:initComponents
159:                prePanel = new javax.swing.JPanel();
160:                preCheckBox = new javax.swing.JCheckBox();
161:                preScrollPane = new javax.swing.JScrollPane();
162:                preEditorPane = new javax.swing.JEditorPane();
163:                postPanel = new javax.swing.JPanel();
164:                postCheckBox = new javax.swing.JCheckBox();
165:                postScrollPane = new javax.swing.JScrollPane();
166:                postEditorPane = new javax.swing.JEditorPane();
167:
168:                setLayout(new java.awt.GridBagLayout());
169:                java.awt.GridBagConstraints gridBagConstraints1;
170:
171:                prePanel.setLayout(new java.awt.GridBagLayout());
172:                java.awt.GridBagConstraints gridBagConstraints2;
173:
174:                preCheckBox.setText("jCheckBox1");
175:                preCheckBox.addItemListener(new java.awt.event.ItemListener() {
176:                    public void itemStateChanged(java.awt.event.ItemEvent evt) {
177:                        preCheckBoxItemStateChanged(evt);
178:                    }
179:                });
180:
181:                gridBagConstraints2 = new java.awt.GridBagConstraints();
182:                gridBagConstraints2.gridwidth = java.awt.GridBagConstraints.REMAINDER;
183:                gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST;
184:                prePanel.add(preCheckBox, gridBagConstraints2);
185:
186:                preScrollPane.setViewportView(preEditorPane);
187:
188:                gridBagConstraints2 = new java.awt.GridBagConstraints();
189:                gridBagConstraints2.gridx = 0;
190:                gridBagConstraints2.gridy = 1;
191:                gridBagConstraints2.gridwidth = java.awt.GridBagConstraints.REMAINDER;
192:                gridBagConstraints2.gridheight = java.awt.GridBagConstraints.REMAINDER;
193:                gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH;
194:                gridBagConstraints2.insets = new java.awt.Insets(5, 0, 0, 0);
195:                gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST;
196:                gridBagConstraints2.weightx = 1.0;
197:                gridBagConstraints2.weighty = 1.0;
198:                prePanel.add(preScrollPane, gridBagConstraints2);
199:
200:                gridBagConstraints1 = new java.awt.GridBagConstraints();
201:                gridBagConstraints1.gridwidth = java.awt.GridBagConstraints.REMAINDER;
202:                gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
203:                gridBagConstraints1.insets = new java.awt.Insets(12, 12, 0, 11);
204:                gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
205:                gridBagConstraints1.weightx = 1.0;
206:                gridBagConstraints1.weighty = 1.0;
207:                add(prePanel, gridBagConstraints1);
208:
209:                postPanel.setLayout(new java.awt.GridBagLayout());
210:                java.awt.GridBagConstraints gridBagConstraints3;
211:
212:                postCheckBox.setText("jCheckBox2");
213:                postCheckBox.addItemListener(new java.awt.event.ItemListener() {
214:                    public void itemStateChanged(java.awt.event.ItemEvent evt) {
215:                        postCheckBoxItemStateChanged(evt);
216:                    }
217:                });
218:
219:                gridBagConstraints3 = new java.awt.GridBagConstraints();
220:                gridBagConstraints3.gridwidth = java.awt.GridBagConstraints.REMAINDER;
221:                gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTHWEST;
222:                postPanel.add(postCheckBox, gridBagConstraints3);
223:
224:                postScrollPane.setViewportView(postEditorPane);
225:
226:                gridBagConstraints3 = new java.awt.GridBagConstraints();
227:                gridBagConstraints3.gridx = 0;
228:                gridBagConstraints3.gridy = 1;
229:                gridBagConstraints3.gridwidth = java.awt.GridBagConstraints.REMAINDER;
230:                gridBagConstraints3.gridheight = java.awt.GridBagConstraints.REMAINDER;
231:                gridBagConstraints3.fill = java.awt.GridBagConstraints.BOTH;
232:                gridBagConstraints3.insets = new java.awt.Insets(5, 0, 0, 0);
233:                gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTHWEST;
234:                gridBagConstraints3.weightx = 1.0;
235:                gridBagConstraints3.weighty = 1.0;
236:                postPanel.add(postScrollPane, gridBagConstraints3);
237:
238:                gridBagConstraints1 = new java.awt.GridBagConstraints();
239:                gridBagConstraints1.gridx = 0;
240:                gridBagConstraints1.gridy = 1;
241:                gridBagConstraints1.gridwidth = java.awt.GridBagConstraints.REMAINDER;
242:                gridBagConstraints1.gridheight = java.awt.GridBagConstraints.REMAINDER;
243:                gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
244:                gridBagConstraints1.insets = new java.awt.Insets(12, 12, 0, 11);
245:                gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
246:                gridBagConstraints1.weightx = 1.0;
247:                gridBagConstraints1.weighty = 1.0;
248:                add(postPanel, gridBagConstraints1);
249:
250:            }//GEN-END:initComponents
251:
252:            private void postCheckBoxItemStateChanged(
253:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_postCheckBoxItemStateChanged
254:                // Add your handling code here:
255:                postEditorPane.setEnabled(postCheckBox.isSelected());
256:                if (postCheckBox.isSelected()) {
257:                    postEditorPane.requestFocus();
258:                }
259:            }//GEN-LAST:event_postCheckBoxItemStateChanged
260:
261:            private void preCheckBoxItemStateChanged(
262:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_preCheckBoxItemStateChanged
263:                // Add your handling code here:
264:                preEditorPane.setEnabled(preCheckBox.isSelected());
265:                if (preCheckBox.isSelected()) {
266:                    preEditorPane.requestFocus();
267:                }
268:            }//GEN-LAST:event_preCheckBoxItemStateChanged
269:
270:            // Variables declaration - do not modify//GEN-BEGIN:variables
271:            private javax.swing.JPanel prePanel;
272:            private javax.swing.JCheckBox preCheckBox;
273:            private javax.swing.JScrollPane preScrollPane;
274:            private javax.swing.JEditorPane preEditorPane;
275:            private javax.swing.JPanel postPanel;
276:            private javax.swing.JCheckBox postCheckBox;
277:            private javax.swing.JScrollPane postScrollPane;
278:            private javax.swing.JEditorPane postEditorPane;
279:            // End of variables declaration//GEN-END:variables
280:
281:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.