KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > editor > ext > FindDialogPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.editor.ext;
21
22 import java.awt.Dimension JavaDoc;
23 import java.util.MissingResourceException JavaDoc;
24 import java.util.ResourceBundle JavaDoc;
25 import javax.swing.JCheckBox JavaDoc;
26 import org.netbeans.editor.SettingsNames;
27 import org.openide.util.NbBundle;
28
29 /**
30  *
31  * @author Miloslav Metelka, Petr Nejedly
32  * @version 1.0
33  * @deprecated Without any replacement.
34  */

35 public class FindDialogPanel extends javax.swing.JPanel JavaDoc {
36
37     static final long serialVersionUID =5048601763767383114L;
38
39     private final ResourceBundle JavaDoc bundle = NbBundle.getBundle(org.netbeans.editor.BaseKit.class);
40
41     /** Initializes the Form */
42     public FindDialogPanel() {
43         initComponents ();
44         getAccessibleContext().setAccessibleName(bundle.getString("find-title")); // NOI18N
45
getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_find")); // NOI18N
46
findWhat.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_" + SettingsNames.FIND_WHAT)); // NOI18N
47
replaceWith.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_" + SettingsNames.FIND_REPLACE_WITH)); // NOI18N
48

49         // #71956
50
Dimension JavaDoc findPrefSize = findWhat.getPreferredSize();
51         Dimension JavaDoc replacePrefSize = replaceWith.getPreferredSize();
52         if (findPrefSize != null){
53             findWhat.setPreferredSize(new Dimension JavaDoc((int)findPrefSize.getWidth(), (int)findPrefSize.getHeight()));
54         }
55         if (replacePrefSize != null){
56             replaceWith.setPreferredSize(new Dimension JavaDoc((int)replacePrefSize.getWidth(), (int)replacePrefSize.getHeight()));
57         }
58     }
59
60     /** This method is called from within the constructor to
61      * initialize the form.
62      * WARNING: Do NOT modify this code. The content of this method is
63      * always regenerated by the FormEditor.
64      */

65     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
66
private void initComponents() {
67         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
68
69         findWhatPanel = new javax.swing.JPanel JavaDoc();
70         findWhatLabel = new javax.swing.JLabel JavaDoc();
71         findWhat = new javax.swing.JComboBox JavaDoc();
72         replaceWithLabel = new javax.swing.JLabel JavaDoc();
73         replaceWith = new javax.swing.JComboBox JavaDoc();
74         highlightSearch = createCheckBox( SettingsNames.FIND_HIGHLIGHT_SEARCH, 'H' );
75         incSearch = createCheckBox( SettingsNames.FIND_INC_SEARCH, 'I' );
76         matchCase = createCheckBox( SettingsNames.FIND_MATCH_CASE, 'C' );
77         wholeWords = createCheckBox( SettingsNames.FIND_WHOLE_WORDS, 'W' );
78         bwdSearch = createCheckBox( SettingsNames.FIND_BACKWARD_SEARCH, 'B' );
79         wrapSearch = createCheckBox( SettingsNames.FIND_WRAP_SEARCH, 'p' );
80         regExp = createCheckBox( SettingsNames.FIND_REG_EXP, 'E' );
81         blockSearch = createCheckBox( SettingsNames.FIND_BLOCK_SEARCH, 'l' );
82
83         setLayout(new java.awt.GridBagLayout JavaDoc());
84
85         findWhatPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
86
87         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
88         gridBagConstraints.gridx = 0;
89         gridBagConstraints.gridy = 0;
90         gridBagConstraints.gridwidth = 3;
91         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
92         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
93         gridBagConstraints.weightx = 1.0;
94         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
95         add(findWhatPanel, gridBagConstraints);
96
97         findWhatLabel.setLabelFor(findWhat);
98         findWhatLabel.setText(bundle.getString(SettingsNames.FIND_WHAT ) );
99         findWhatLabel.setDisplayedMnemonic(bundle.getString(SettingsNames.FIND_WHAT + "-mnemonic").charAt(0));
100         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
101         gridBagConstraints.gridx = 0;
102         gridBagConstraints.gridy = 1;
103         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
104         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 5, 0);
105         add(findWhatLabel, gridBagConstraints);
106
107         findWhat.setEditable(true);
108         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
109         gridBagConstraints.gridx = 1;
110         gridBagConstraints.gridy = 1;
111         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
112         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
113         gridBagConstraints.weightx = 1.0;
114         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 11, 9, 10);
115         add(findWhat, gridBagConstraints);
116
117         replaceWithLabel.setLabelFor(replaceWith);
118         replaceWithLabel.setText(bundle.getString(SettingsNames.FIND_REPLACE_WITH ) );
119         replaceWithLabel.setDisplayedMnemonic(bundle.getString(SettingsNames.FIND_REPLACE_WITH + "-mnemonic").charAt(0));
120         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
121         gridBagConstraints.gridx = 0;
122         gridBagConstraints.gridy = 2;
123         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
124         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 9, 0);
125         add(replaceWithLabel, gridBagConstraints);
126
127         replaceWith.setEditable(true);
128         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
129         gridBagConstraints.gridx = 1;
130         gridBagConstraints.gridy = 2;
131         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
132         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
133         gridBagConstraints.weightx = 1.0;
134         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 11, 9, 10);
135         add(replaceWith, gridBagConstraints);
136
137         highlightSearch.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
138         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
139         gridBagConstraints.gridx = 1;
140         gridBagConstraints.gridy = 6;
141         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
142         gridBagConstraints.weighty = 1.0;
143         gridBagConstraints.insets = new java.awt.Insets JavaDoc(11, 11, 11, 0);
144         add(highlightSearch, gridBagConstraints);
145
146         incSearch.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
147         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
148         gridBagConstraints.gridx = 2;
149         gridBagConstraints.gridy = 6;
150         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
151         gridBagConstraints.insets = new java.awt.Insets JavaDoc(11, 11, 11, 10);
152         add(incSearch, gridBagConstraints);
153
154         matchCase.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
155         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
156         gridBagConstraints.gridx = 1;
157         gridBagConstraints.gridy = 3;
158         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
159         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 11, 0, 0);
160         add(matchCase, gridBagConstraints);
161
162         wholeWords.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
163         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
164         gridBagConstraints.gridx = 1;
165         gridBagConstraints.gridy = 4;
166         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
167         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 11, 0, 0);
168         add(wholeWords, gridBagConstraints);
169
170         bwdSearch.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
171         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
172         gridBagConstraints.gridx = 2;
173         gridBagConstraints.gridy = 5;
174         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
175         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 11, 0, 10);
176         add(bwdSearch, gridBagConstraints);
177
178         wrapSearch.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
179         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
180         gridBagConstraints.gridx = 2;
181         gridBagConstraints.gridy = 3;
182         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
183         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 11, 0, 10);
184         add(wrapSearch, gridBagConstraints);
185
186         regExp.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
187         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
188         gridBagConstraints.gridx = 1;
189         gridBagConstraints.gridy = 5;
190         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
191         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 11, 0, 0);
192         add(regExp, gridBagConstraints);
193
194         blockSearch.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
195         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
196         gridBagConstraints.gridx = 2;
197         gridBagConstraints.gridy = 4;
198         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
199         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 11, 0, 10);
200         add(blockSearch, gridBagConstraints);
201
202     }// </editor-fold>//GEN-END:initComponents
203

204
205     // Variables declaration - do not modify//GEN-BEGIN:variables
206
protected javax.swing.JCheckBox JavaDoc blockSearch;
207     protected javax.swing.JCheckBox JavaDoc bwdSearch;
208     protected javax.swing.JComboBox JavaDoc findWhat;
209     protected javax.swing.JLabel JavaDoc findWhatLabel;
210     protected javax.swing.JPanel JavaDoc findWhatPanel;
211     protected javax.swing.JCheckBox JavaDoc highlightSearch;
212     protected javax.swing.JCheckBox JavaDoc incSearch;
213     protected javax.swing.JCheckBox JavaDoc matchCase;
214     protected javax.swing.JCheckBox JavaDoc regExp;
215     protected javax.swing.JComboBox JavaDoc replaceWith;
216     protected javax.swing.JLabel JavaDoc replaceWithLabel;
217     protected javax.swing.JCheckBox JavaDoc wholeWords;
218     protected javax.swing.JCheckBox JavaDoc wrapSearch;
219     // End of variables declaration//GEN-END:variables
220

221
222     private JCheckBox JavaDoc createCheckBox( String JavaDoc key, char mnemonic ) {
223         JCheckBox JavaDoc box = new JCheckBox JavaDoc( bundle.getString( key ) );
224         box.setToolTipText( bundle.getString( key + "-tooltip" ) );
225         char mnemonicChar;
226         try {
227             mnemonicChar = bundle.getString( key + "-mnemonic").charAt(0);
228         } catch (MissingResourceException JavaDoc e) {
229             mnemonicChar = mnemonic;
230         }
231         box.setMnemonic(mnemonicChar); // NOI18N
232
return box;
233     }
234     
235 }
236
Popular Tags