KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > properties > FindPanel


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20
21 package org.netbeans.modules.properties;
22
23 import java.awt.event.KeyEvent JavaDoc;
24 import java.awt.event.KeyAdapter JavaDoc;
25 import java.awt.ContainerOrderFocusTraversalPolicy JavaDoc;
26 import javax.swing.JButton JavaDoc;
27 import javax.swing.JCheckBox JavaDoc;
28 import javax.swing.JComboBox JavaDoc;
29
30 import org.openide.util.NbBundle;
31
32
33 /**
34  * Find panel for Resource Bundles table view component. GUI represenation only.
35  *
36  * @author Peter Zavadsky
37  */

38 public class FindPanel extends javax.swing.JPanel JavaDoc {
39
40     /** Creates new form FindPanel. */
41     public FindPanel() {
42         initComponents ();
43         initAccessibility ();
44         findCombo.getEditor().getEditorComponent().addKeyListener(new KeyAdapter JavaDoc() {
45              public void keyTyped(KeyEvent JavaDoc evt) {
46                 if (evt.getKeyChar() == '\n') {
47                     findButton.doClick(20);
48                     evt.consume();
49                 }
50             }
51         });
52     }
53
54     private String JavaDoc getBundleString(String JavaDoc s){
55         return NbBundle.getMessage(FindPanel.class, s);
56     }
57
58     // Accessor methods.
59

60     /** Accessor to buttons. */
61     public JButton JavaDoc[] getButtons() {
62         return new JButton JavaDoc[] { findButton, cancelButton};
63     }
64     
65     /** Accessor to combo box. */
66     public JComboBox JavaDoc getComboBox() {
67         return findCombo;
68     }
69
70     /** Accessor to highlight check box. */
71     public JCheckBox JavaDoc getHighlightCheck() {
72         return highlightCheck;
73     }
74     
75     /** Accessor to match case check box. */
76     public JCheckBox JavaDoc getMatchCaseCheck() {
77         return matchCaseCheck;
78     }
79     
80     /** Accessor to backward check box. */
81     public JCheckBox JavaDoc getBackwardCheck() {
82         return backwardCheck;
83     }
84     
85     /** Accessor to wrap check box. */
86     public JCheckBox JavaDoc getWrapCheck() {
87         return wrapCheck;
88     }
89     
90     /** Accessor to row check box. */
91     public JCheckBox JavaDoc getRowCheck() {
92         return rowCheck;
93     }
94     
95     private void initAccessibility () {
96         this.getAccessibleContext().setAccessibleDescription(getBundleString("ACS_FindPanel"));
97         
98         findButton.getAccessibleContext().setAccessibleDescription(getBundleString("ACS_CTL_Find"));
99         rowCheck.getAccessibleContext().setAccessibleDescription(getBundleString("ACS_CTL_SearchByRows"));
100         wrapCheck.getAccessibleContext().setAccessibleDescription(getBundleString("ACS_CTL_WrapSearch"));
101         matchCaseCheck.getAccessibleContext().setAccessibleDescription(getBundleString("ACS_CTL_MatchCaseCheck"));
102         cancelButton.getAccessibleContext().setAccessibleDescription(getBundleString("ACS_CTL_Cancel"));
103         backwardCheck.getAccessibleContext().setAccessibleDescription(getBundleString("ACS_CTL_BackwardCheck"));
104         findCombo.getAccessibleContext().setAccessibleDescription(getBundleString("ACS_CTL_FindCombo"));
105         highlightCheck.getAccessibleContext().setAccessibleDescription(getBundleString("ACS_CTL_HighlightCheck"));
106         
107     }
108     
109     /** This method is called from within the constructor to
110      * initialize the form.
111      * WARNING: Do NOT modify this code. The content of this method is
112      * always regenerated by the Form Editor.
113      */

114     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
115
private void initComponents() {
116         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
117
118         findLabel = new javax.swing.JLabel JavaDoc();
119         findCombo = new javax.swing.JComboBox JavaDoc();
120         highlightCheck = new javax.swing.JCheckBox JavaDoc();
121         matchCaseCheck = new javax.swing.JCheckBox JavaDoc();
122         backwardCheck = new javax.swing.JCheckBox JavaDoc();
123         wrapCheck = new javax.swing.JCheckBox JavaDoc();
124         rowCheck = new javax.swing.JCheckBox JavaDoc();
125         findButton = new javax.swing.JButton JavaDoc();
126         cancelButton = new javax.swing.JButton JavaDoc();
127
128         setFocusCycleRoot(true);
129         setFocusTraversalPolicy(new ContainerOrderFocusTraversalPolicy JavaDoc());
130         setLayout(new java.awt.GridBagLayout JavaDoc());
131
132         findLabel.setLabelFor(findCombo);
133         org.openide.awt.Mnemonics.setLocalizedText(findLabel, getBundleString("LBL_Find")); // NOI18N
134
findLabel.setFocusable(false);
135         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
136         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
137         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
138         add(findLabel, gridBagConstraints);
139
140         findCombo.setEditable(true);
141         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
142         gridBagConstraints.gridx = 1;
143         gridBagConstraints.gridy = 0;
144         gridBagConstraints.gridwidth = 2;
145         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
146         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
147         gridBagConstraints.weightx = 1.0;
148         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 11, 0, 0);
149         add(findCombo, gridBagConstraints);
150
151         org.openide.awt.Mnemonics.setLocalizedText(highlightCheck, getBundleString("CTL_HighlightCheck")); // NOI18N
152
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
153         gridBagConstraints.gridx = 0;
154         gridBagConstraints.gridy = 1;
155         gridBagConstraints.gridwidth = 2;
156         gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
157         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 0);
158         add(highlightCheck, gridBagConstraints);
159
160         org.openide.awt.Mnemonics.setLocalizedText(matchCaseCheck, getBundleString("CTL_MatchCaseCheck")); // NOI18N
161
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
162         gridBagConstraints.gridx = 0;
163         gridBagConstraints.gridy = 2;
164         gridBagConstraints.gridwidth = 2;
165         gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
166         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 0, 0);
167         add(matchCaseCheck, gridBagConstraints);
168
169         org.openide.awt.Mnemonics.setLocalizedText(backwardCheck, getBundleString("CTL_BackwardCheck")); // NOI18N
170
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
171         gridBagConstraints.gridx = 0;
172         gridBagConstraints.gridy = 3;
173         gridBagConstraints.gridwidth = 2;
174         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
175         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 11, 0);
176         add(backwardCheck, gridBagConstraints);
177
178         org.openide.awt.Mnemonics.setLocalizedText(wrapCheck, getBundleString("CTL_WrapSearch")); // NOI18N
179
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
180         gridBagConstraints.gridx = 2;
181         gridBagConstraints.gridy = 1;
182         gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
183         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 0);
184         add(wrapCheck, gridBagConstraints);
185
186         org.openide.awt.Mnemonics.setLocalizedText(rowCheck, getBundleString("CTL_SearchByRows")); // NOI18N
187
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
188         gridBagConstraints.gridx = 2;
189         gridBagConstraints.gridy = 2;
190         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
191         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 11, 0, 0);
192         add(rowCheck, gridBagConstraints);
193
194         findButton.setText(getBundleString("CTL_Find")); // NOI18N
195
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
196         gridBagConstraints.gridx = 3;
197         gridBagConstraints.gridy = 0;
198         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
199         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
200         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 11, 0, 11);
201         add(findButton, gridBagConstraints);
202
203         cancelButton.setText(getBundleString("CTL_Cancel")); // NOI18N
204
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
205         gridBagConstraints.gridx = 3;
206         gridBagConstraints.gridy = 1;
207         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
208         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
209         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 11, 0, 11);
210         add(cancelButton, gridBagConstraints);
211     }// </editor-fold>//GEN-END:initComponents
212

213     public boolean requestFocusInWindow() {
214         return findCombo.requestFocusInWindow();
215     }
216
217     // Variables declaration - do not modify//GEN-BEGIN:variables
218
private javax.swing.JCheckBox JavaDoc backwardCheck;
219     private javax.swing.JButton JavaDoc cancelButton;
220     private javax.swing.JButton JavaDoc findButton;
221     private javax.swing.JComboBox JavaDoc findCombo;
222     private javax.swing.JLabel JavaDoc findLabel;
223     private javax.swing.JCheckBox JavaDoc highlightCheck;
224     private javax.swing.JCheckBox JavaDoc matchCaseCheck;
225     private javax.swing.JCheckBox JavaDoc rowCheck;
226     private javax.swing.JCheckBox JavaDoc wrapCheck;
227     // End of variables declaration//GEN-END:variables
228

229 }
230
Popular Tags