25 package org.sleuthkit.autopsy.filesearch;
28 import java.awt.event.ActionEvent;
29 import java.awt.event.ActionListener;
30 import javax.swing.JCheckBox;
31 import javax.swing.JMenuItem;
32 import javax.swing.JTextField;
38 class NameSearchPanel
extends javax.swing.JPanel {
43 customizeComponents();
46 private void customizeComponents(){
48 searchTextField.setComponentPopupMenu(rightClickMenu);
49 ActionListener actList =
new ActionListener(){
51 public void actionPerformed(ActionEvent e){
52 JMenuItem jmi = (JMenuItem) e.getSource();
53 if(jmi.equals(cutMenuItem))
54 searchTextField.cut();
55 else if(jmi.equals(copyMenuItem))
56 searchTextField.copy();
57 else if(jmi.equals(pasteMenuItem))
58 searchTextField.paste();
59 else if(jmi.equals(selectAllMenuItem))
60 searchTextField.selectAll();
63 cutMenuItem.addActionListener(actList);
64 copyMenuItem.addActionListener(actList);
65 pasteMenuItem.addActionListener(actList);
66 selectAllMenuItem.addActionListener(actList);
70 JCheckBox getNameCheckBox() {
74 JTextField getSearchTextField() {
75 return searchTextField;
83 @SuppressWarnings(
"unchecked")
85 private
void initComponents() {
87 rightClickMenu =
new javax.swing.JPopupMenu();
88 cutMenuItem =
new javax.swing.JMenuItem();
89 copyMenuItem =
new javax.swing.JMenuItem();
90 pasteMenuItem =
new javax.swing.JMenuItem();
91 selectAllMenuItem =
new javax.swing.JMenuItem();
92 nameCheckBox =
new javax.swing.JCheckBox();
93 searchTextField =
new javax.swing.JTextField();
94 noteNameLabel =
new javax.swing.JLabel();
96 cutMenuItem.setText(
org.openide.util.NbBundle.getMessage(NameSearchPanel.class,
"NameSearchPanel.cutMenuItem.text"));
97 rightClickMenu.add(cutMenuItem);
99 copyMenuItem.setText(
org.openide.util.NbBundle.getMessage(NameSearchPanel.class,
"NameSearchPanel.copyMenuItem.text"));
100 rightClickMenu.add(copyMenuItem);
102 pasteMenuItem.setText(
org.openide.util.NbBundle.getMessage(NameSearchPanel.class,
"NameSearchPanel.pasteMenuItem.text"));
103 rightClickMenu.add(pasteMenuItem);
105 selectAllMenuItem.setText(
org.openide.util.NbBundle.getMessage(NameSearchPanel.class,
"NameSearchPanel.selectAllMenuItem.text"));
106 rightClickMenu.add(selectAllMenuItem);
108 nameCheckBox.setText(
org.openide.util.NbBundle.getMessage(NameSearchPanel.class,
"NameSearchPanel.nameCheckBox.text"));
110 searchTextField.setText(
org.openide.util.NbBundle.getMessage(NameSearchPanel.class,
"NameSearchPanel.searchTextField.text"));
111 searchTextField.addMouseListener(
new java.awt.event.MouseAdapter() {
112 public void mouseClicked(java.awt.event.MouseEvent evt) {
113 searchTextFieldMouseClicked(evt);
117 noteNameLabel.setFont(noteNameLabel.getFont().deriveFont(Font.PLAIN, 10));
118 noteNameLabel.setText(
org.openide.util.NbBundle.getMessage(NameSearchPanel.class,
"NameSearchPanel.noteNameLabel.text"));
120 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
121 this.setLayout(layout);
122 layout.setHorizontalGroup(
123 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
124 .addGroup(layout.createSequentialGroup()
125 .addComponent(nameCheckBox)
126 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
127 .addGroup(layout.createSequentialGroup()
129 .addComponent(noteNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
131 .addGroup(layout.createSequentialGroup()
132 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
133 .addComponent(searchTextField))))
135 layout.setVerticalGroup(
136 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
137 .addGroup(layout.createSequentialGroup()
138 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
139 .addComponent(nameCheckBox)
140 .addComponent(searchTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
141 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
142 .addComponent(noteNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
146 private void searchTextFieldMouseClicked(java.awt.event.MouseEvent evt) {
148 this.nameCheckBox.setSelected(
true); }
150 private javax.swing.JMenuItem copyMenuItem;
151 private javax.swing.JMenuItem cutMenuItem;
152 private javax.swing.JCheckBox nameCheckBox;
153 private javax.swing.JLabel noteNameLabel;
154 private javax.swing.JMenuItem pasteMenuItem;
155 private javax.swing.JPopupMenu rightClickMenu;
156 private javax.swing.JTextField searchTextField;
157 private javax.swing.JMenuItem selectAllMenuItem;
160 void addActionListener(ActionListener l) {
161 searchTextField.addActionListener(l);