12 |
import javax.swing.JRootPane; |
import javax.swing.JRootPane; |
13 |
import javax.swing.KeyStroke; |
import javax.swing.KeyStroke; |
14 |
|
|
15 |
|
import net.miginfocom.swing.MigLayout; |
16 |
import schmitzm.swing.SwingUtil; |
import schmitzm.swing.SwingUtil; |
17 |
|
|
18 |
|
/** |
19 |
|
* A basic super class for atlas dialogs. It listens to the ESC key and calls |
20 |
|
* the {@link #close()} method. The layout manager is initialized with |
21 |
|
* {@link MigLayout}. |
22 |
|
*/ |
23 |
public class AtlasDialog extends JDialog { |
public class AtlasDialog extends JDialog { |
24 |
|
|
25 |
public AtlasDialog(final Component owner, String title) { |
public AtlasDialog(final Component owner, String title) { |
27 |
initDialog(); |
initDialog(); |
28 |
} |
} |
29 |
|
|
30 |
|
/** A flag checking that we just get disposed once **/ |
31 |
|
protected boolean isDisposed = false; |
32 |
|
|
33 |
public AtlasDialog(final Component parentWindowComponent) { |
public AtlasDialog(final Component parentWindowComponent) { |
34 |
this(parentWindowComponent, null); |
this(parentWindowComponent, null); |
35 |
} |
} |
36 |
|
|
37 |
private void initDialog() { |
private void initDialog() { |
38 |
|
|
39 |
|
setLayout(new MigLayout("gap 1, inset 1")); |
40 |
|
|
41 |
setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); |
setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); |
42 |
|
|
43 |
addWindowListener(new WindowAdapter() { |
addWindowListener(new WindowAdapter() { |
82 |
|
|
83 |
return rootPane; |
return rootPane; |
84 |
} |
} |
85 |
|
|
86 |
|
@Override |
87 |
|
public void dispose() { |
88 |
|
super.dispose(); |
89 |
|
isDisposed = true; |
90 |
|
} |
91 |
} |
} |