19 package org.sleuthkit.autopsy.ingest;
21 import java.awt.BorderLayout;
22 import java.awt.Container;
23 import java.awt.Dialog;
24 import java.awt.Dimension;
25 import java.awt.Toolkit;
26 import java.awt.Window;
27 import java.awt.event.KeyEvent;
28 import java.awt.event.WindowAdapter;
29 import java.awt.event.WindowEvent;
30 import javax.swing.JComponent;
31 import javax.swing.JDialog;
32 import javax.swing.KeyStroke;
33 import org.openide.util.NbBundle;
34 import org.openide.windows.WindowManager;
42 private static final Dimension
DIMENSIONS =
new Dimension(500, 300);
48 this((Window) WindowManager.getDefault().getMainWindow(),
false);
49 setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
60 super((Window) owner, TITLE, ModalityType.MODELESS);
61 if (shouldBeModal && owner instanceof JDialog) {
62 final JDialog pseudoOwner = (JDialog) owner;
63 final ModalityType originalModality = pseudoOwner.getModalityType();
64 addWindowListener(
new WindowAdapter() {
66 public void windowClosed(WindowEvent e) {
67 pseudoOwner.setVisible(
false);
68 pseudoOwner.setModalityType(originalModality);
69 pseudoOwner.toFront();
70 pseudoOwner.setVisible(
true);
73 pseudoOwner.setVisible(
false);
74 pseudoOwner.setModalityType(Dialog.ModalityType.MODELESS);
75 pseudoOwner.toFront();
76 pseudoOwner.repaint();
77 pseudoOwner.setVisible(
true);
80 setLayout(
new BorderLayout());
81 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
83 int w = this.getSize().width;
84 int h = this.getSize().height;
85 setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
86 this.getRootPane().registerKeyboardAction(e -> {
88 }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
static final Dimension DIMENSIONS
static final String TITLE
IngestProgressSnapshotDialog(Container owner, Boolean shouldBeModal)
IngestProgressSnapshotDialog()