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