19 package org.sleuthkit.autopsy.modules.hashdatabase;
21 import java.awt.Dimension;
22 import java.awt.Toolkit;
23 import java.awt.event.ActionEvent;
24 import java.awt.event.ActionListener;
25 import java.util.ArrayList;
26 import java.util.List;
27 import java.util.regex.Pattern;
28 import javax.swing.JFrame;
29 import javax.swing.JMenuItem;
30 import javax.swing.JPopupMenu;
31 import javax.swing.SwingUtilities;
32 import org.openide.util.NbBundle;
33 import org.openide.windows.WindowManager;
44 Pattern md5Pattern = Pattern.compile(
"^[a-fA-F0-9]{32}$");
45 List<HashEntry> hashes =
new ArrayList<>();
46 List<String> invalidHashes =
new ArrayList<>();
53 super((JFrame) WindowManager.getDefault().getMainWindow(),
62 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
63 setLocation((screenDimension.width - getSize().width) / 2, (screenDimension.height - getSize().height) / 2);
73 void enableAddHashValuesToDatabaseDialog(
boolean enable) {
75 setDefaultCloseOperation(2);
77 setDefaultCloseOperation(0);
89 @SuppressWarnings(
"unchecked")
100 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
108 public void mouseClicked(java.awt.event.MouseEvent evt) {
116 public void actionPerformed(java.awt.event.ActionEvent evt) {
123 public void actionPerformed(java.awt.event.ActionEvent evt) {
129 cancelButton.addActionListener(
new java.awt.event.ActionListener() {
130 public void actionPerformed(java.awt.event.ActionEvent evt) {
135 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
136 getContentPane().setLayout(layout);
137 layout.setHorizontalGroup(
138 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
139 .addGroup(layout.createSequentialGroup()
141 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
142 .addGroup(layout.createSequentialGroup()
143 .addComponent(
instructionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
144 .addGap(0, 41, Short.MAX_VALUE))
147 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
149 .addComponent(
cancelButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
150 .addComponent(
pasteFromClipboardButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
153 layout.setVerticalGroup(
154 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
155 .addGroup(layout.createSequentialGroup()
158 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
159 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
160 .addGroup(layout.createSequentialGroup()
162 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
164 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
166 .addComponent(
jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE))
184 if (SwingUtilities.isRightMouseButton(evt)) {
185 JPopupMenu popup =
new JPopupMenu();
187 JMenuItem cutMenu =
new JMenuItem(
"Cut");
188 cutMenu.addActionListener(
new ActionListener() {
190 public void actionPerformed(ActionEvent e) {
195 JMenuItem copyMenu =
new JMenuItem(
"Copy");
196 copyMenu.addActionListener(
new ActionListener() {
198 public void actionPerformed(ActionEvent e) {
203 JMenuItem pasteMenu =
new JMenuItem(
"Paste");
204 pasteMenu.addActionListener(
new ActionListener() {
206 public void actionPerformed(ActionEvent e) {
214 popup.add(pasteMenu);
221 progressDialog.addHashValuesToDatabase();
void cancelButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JButton pasteFromClipboardButton
void hashValuesTextAreaMouseClicked(java.awt.event.MouseEvent evt)
void pasteFromClipboardButtonActionPerformed(java.awt.event.ActionEvent evt)
void AddValuesToHashDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JTextArea hashValuesTextArea
javax.swing.JButton AddValuesToHashDatabaseButton
javax.swing.JLabel instructionLabel
javax.swing.JScrollPane jScrollPane1
javax.swing.JButton cancelButton