001: /*
002: * Sun Public License Notice
003: *
004: * The contents of this file are subject to the Sun Public License
005: * Version 1.0 (the "License"). You may not use this file except in
006: * compliance with the License. A copy of the License is available at
007: * http://www.sun.com/
008: *
009: * The Original Code is NetBeans. The Initial Developer of the Original
010: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
011: * Microsystems, Inc. All Rights Reserved.
012: */
013:
014: package org.netbeans.editor.ext;
015:
016: import javax.swing.JCheckBox;
017:
018: import org.netbeans.editor.LocaleSupport;
019: import org.netbeans.editor.SettingsNames;
020:
021: /**
022: *
023: * @author Miloslav Metelka, Petr Nejedly
024: * @version 1.0
025: */
026: public class FindDialogPanel extends javax.swing.JPanel {
027:
028: static final long serialVersionUID = 5048601763767383114L;
029:
030: /** Initializes the Form */
031: public FindDialogPanel() {
032: initComponents();
033: getAccessibleContext().setAccessibleName(
034: LocaleSupport.getString("find-title")); // NOI18N
035: getAccessibleContext().setAccessibleDescription(
036: LocaleSupport.getString("ACSD_find")); // NOI18N
037: findWhat.getAccessibleContext().setAccessibleDescription(
038: LocaleSupport.getString("ACSD_"
039: + SettingsNames.FIND_WHAT)); // NOI18N
040: replaceWith.getAccessibleContext().setAccessibleDescription(
041: LocaleSupport.getString("ACSD_"
042: + SettingsNames.FIND_REPLACE_WITH)); // NOI18N
043: }
044:
045: /**
046: * This method is called from within the constructor to initialize the form.
047: * WARNING: Do NOT modify this code. The content of this method is always
048: * regenerated by the FormEditor.
049: */
050: private void initComponents() {// GEN-BEGIN:initComponents
051: findWhatPanel = new javax.swing.JPanel();
052: findWhatLabel = new javax.swing.JLabel();
053: findWhat = new javax.swing.JComboBox();
054: replaceWithLabel = new javax.swing.JLabel();
055: replaceWith = new javax.swing.JComboBox();
056: highlightSearch = createCheckBox(
057: SettingsNames.FIND_HIGHLIGHT_SEARCH, 'H');
058: incSearch = createCheckBox(SettingsNames.FIND_INC_SEARCH, 'I');
059: matchCase = createCheckBox(SettingsNames.FIND_MATCH_CASE, 'C');
060: smartCase = createCheckBox(SettingsNames.FIND_SMART_CASE, 'S');
061: wholeWords = createCheckBox(SettingsNames.FIND_WHOLE_WORDS, 'W');
062: bwdSearch = createCheckBox(SettingsNames.FIND_BACKWARD_SEARCH,
063: 'B');
064: wrapSearch = createCheckBox(SettingsNames.FIND_WRAP_SEARCH, 'p');
065: regExp = createCheckBox(SettingsNames.FIND_REG_EXP, 'E');
066:
067: setLayout(new java.awt.GridBagLayout());
068: java.awt.GridBagConstraints gridBagConstraints1;
069:
070: findWhatPanel.setLayout(new java.awt.GridBagLayout());
071: java.awt.GridBagConstraints gridBagConstraints2;
072:
073: gridBagConstraints1 = new java.awt.GridBagConstraints();
074: gridBagConstraints1.gridx = 0;
075: gridBagConstraints1.gridy = 0;
076: gridBagConstraints1.gridwidth = 3;
077: gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
078: gridBagConstraints1.insets = new java.awt.Insets(12, 0, 0, 0);
079: gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTH;
080: gridBagConstraints1.weightx = 1.0;
081: add(findWhatPanel, gridBagConstraints1);
082:
083: findWhatLabel.setText(LocaleSupport
084: .getString(SettingsNames.FIND_WHAT));
085: findWhatLabel.setLabelFor(findWhat);
086: findWhatLabel.setDisplayedMnemonic(LocaleSupport.getChar(
087: SettingsNames.FIND_WHAT + "-mnemonic", 'n'));
088: gridBagConstraints1 = new java.awt.GridBagConstraints();
089: gridBagConstraints1.gridx = 0;
090: gridBagConstraints1.gridy = 1;
091: gridBagConstraints1.insets = new java.awt.Insets(0, 12, 5, 0);
092: gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
093: add(findWhatLabel, gridBagConstraints1);
094:
095: findWhat.setEditable(true);
096: gridBagConstraints1 = new java.awt.GridBagConstraints();
097: gridBagConstraints1.gridx = 1;
098: gridBagConstraints1.gridy = 1;
099: gridBagConstraints1.gridwidth = java.awt.GridBagConstraints.REMAINDER;
100: gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
101: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 9, 10);
102: gridBagConstraints1.weightx = 1.0;
103: add(findWhat, gridBagConstraints1);
104:
105: replaceWithLabel.setText(LocaleSupport
106: .getString(SettingsNames.FIND_REPLACE_WITH));
107: replaceWithLabel.setLabelFor(replaceWith);
108: replaceWithLabel.setDisplayedMnemonic(LocaleSupport.getChar(
109: SettingsNames.FIND_REPLACE_WITH + "-mnemonic", 'l'));
110: gridBagConstraints1 = new java.awt.GridBagConstraints();
111: gridBagConstraints1.gridx = 0;
112: gridBagConstraints1.gridy = 2;
113: gridBagConstraints1.insets = new java.awt.Insets(0, 12, 9, 0);
114: gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
115: add(replaceWithLabel, gridBagConstraints1);
116:
117: replaceWith.setEditable(true);
118: gridBagConstraints1 = new java.awt.GridBagConstraints();
119: gridBagConstraints1.gridx = 1;
120: gridBagConstraints1.gridy = 2;
121: gridBagConstraints1.gridwidth = java.awt.GridBagConstraints.REMAINDER;
122: gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
123: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 9, 10);
124: gridBagConstraints1.weightx = 1.0;
125: add(replaceWith, gridBagConstraints1);
126:
127: highlightSearch.setBorder(new javax.swing.border.EmptyBorder(
128: new java.awt.Insets(1, 1, 1, 1)));
129: gridBagConstraints1 = new java.awt.GridBagConstraints();
130: gridBagConstraints1.gridx = 2;
131: gridBagConstraints1.gridy = 3;
132: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 0, 10);
133: gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
134: add(highlightSearch, gridBagConstraints1);
135:
136: incSearch.setBorder(new javax.swing.border.EmptyBorder(
137: new java.awt.Insets(1, 1, 1, 1)));
138: gridBagConstraints1 = new java.awt.GridBagConstraints();
139: gridBagConstraints1.gridx = 2;
140: gridBagConstraints1.gridy = 4;
141: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 0, 10);
142: gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
143: add(incSearch, gridBagConstraints1);
144:
145: matchCase.setBorder(new javax.swing.border.EmptyBorder(
146: new java.awt.Insets(1, 1, 1, 1)));
147: gridBagConstraints1 = new java.awt.GridBagConstraints();
148: gridBagConstraints1.gridx = 1;
149: gridBagConstraints1.gridy = 3;
150: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 0, 0);
151: gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
152: add(matchCase, gridBagConstraints1);
153:
154: smartCase.setBorder(new javax.swing.border.EmptyBorder(
155: new java.awt.Insets(1, 1, 1, 1)));
156: gridBagConstraints1 = new java.awt.GridBagConstraints();
157: gridBagConstraints1.gridx = 1;
158: gridBagConstraints1.gridy = 4;
159: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 0, 0);
160: gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
161: add(smartCase, gridBagConstraints1);
162:
163: wholeWords.setBorder(new javax.swing.border.EmptyBorder(
164: new java.awt.Insets(1, 1, 1, 1)));
165: gridBagConstraints1 = new java.awt.GridBagConstraints();
166: gridBagConstraints1.gridx = 1;
167: gridBagConstraints1.gridy = 5;
168: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 0, 0);
169: gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
170: add(wholeWords, gridBagConstraints1);
171:
172: bwdSearch.setBorder(new javax.swing.border.EmptyBorder(
173: new java.awt.Insets(1, 1, 1, 1)));
174: gridBagConstraints1 = new java.awt.GridBagConstraints();
175: gridBagConstraints1.gridx = 2;
176: gridBagConstraints1.gridy = 5;
177: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 0, 10);
178: gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
179: add(bwdSearch, gridBagConstraints1);
180:
181: wrapSearch.setBorder(new javax.swing.border.EmptyBorder(
182: new java.awt.Insets(1, 1, 1, 1)));
183: gridBagConstraints1 = new java.awt.GridBagConstraints();
184: gridBagConstraints1.gridx = 2;
185: gridBagConstraints1.gridy = 6;
186: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 11, 10);
187: gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
188: gridBagConstraints1.weighty = 1.0;
189: add(wrapSearch, gridBagConstraints1);
190:
191: regExp.setBorder(new javax.swing.border.EmptyBorder(
192: new java.awt.Insets(1, 1, 1, 1)));
193: gridBagConstraints1 = new java.awt.GridBagConstraints();
194: gridBagConstraints1.gridx = 1;
195: gridBagConstraints1.gridy = 6;
196: gridBagConstraints1.insets = new java.awt.Insets(0, 11, 11, 0);
197: gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
198: gridBagConstraints1.weighty = 1.0;
199: add(regExp, gridBagConstraints1);
200:
201: }// GEN-END:initComponents
202:
203: // Variables declaration - do not modify//GEN-BEGIN:variables
204: protected javax.swing.JPanel findWhatPanel;
205: protected javax.swing.JLabel findWhatLabel;
206: protected javax.swing.JComboBox findWhat;
207: protected javax.swing.JLabel replaceWithLabel;
208: protected javax.swing.JComboBox replaceWith;
209: protected javax.swing.JCheckBox highlightSearch;
210: protected javax.swing.JCheckBox incSearch;
211: protected javax.swing.JCheckBox matchCase;
212: protected javax.swing.JCheckBox smartCase;
213: protected javax.swing.JCheckBox wholeWords;
214: protected javax.swing.JCheckBox bwdSearch;
215: protected javax.swing.JCheckBox wrapSearch;
216: protected javax.swing.JCheckBox regExp;
217:
218: // End of variables declaration//GEN-END:variables
219:
220: private JCheckBox createCheckBox(String key, char mnemonic) {
221: JCheckBox box = new JCheckBox(LocaleSupport.getString(key));
222: box.setToolTipText(LocaleSupport.getString(key + "-tooltip"));
223: box.setMnemonic(LocaleSupport.getChar(key + "-mnemonic",
224: mnemonic));
225: return box;
226: }
227:
228: }
|