2 |
|
|
3 |
import java.awt.Component; |
import java.awt.Component; |
4 |
import java.awt.Dialog; |
import java.awt.Dialog; |
5 |
|
import java.awt.event.ActionEvent; |
6 |
import java.util.Locale; |
import java.util.Locale; |
7 |
|
|
8 |
|
import javax.swing.AbstractAction; |
9 |
import javax.swing.JDialog; |
import javax.swing.JDialog; |
10 |
import javax.swing.JOptionPane; |
import javax.swing.JOptionPane; |
11 |
|
|
31 |
|
|
32 |
/** Has this dialog been canceled ?**/ |
/** Has this dialog been canceled ?**/ |
33 |
protected boolean cancelled = false; |
protected boolean cancelled = false; |
34 |
|
|
35 |
|
private OkButton okButton; |
36 |
|
private CancelButton cancelButton; |
37 |
|
|
38 |
public CancellableDialogAdapter(Component parentWindow) { |
public CancellableDialogAdapter(Component parentWindow) { |
39 |
super(parentWindow); |
super(parentWindow); |
112 |
dispose(); |
dispose(); |
113 |
return true; |
return true; |
114 |
} |
} |
115 |
|
|
116 |
|
/** |
117 |
|
* @return a default OkButton that will call {@link #okClose()} |
118 |
|
*/ |
119 |
|
protected OkButton getOkButton() { |
120 |
|
if (okButton == null) { |
121 |
|
okButton = new OkButton(new AbstractAction() { |
122 |
|
|
123 |
|
@Override |
124 |
|
public void actionPerformed(ActionEvent e) { |
125 |
|
okClose(); |
126 |
|
} |
127 |
|
}); |
128 |
|
} |
129 |
|
return okButton; |
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
|
/** |
134 |
|
* @return a default CancelButton that will call {@link #cancelClose()} |
135 |
|
*/ |
136 |
|
protected CancelButton getCancelButton() { |
137 |
|
if (cancelButton == null) { |
138 |
|
cancelButton = new CancelButton(new AbstractAction() { |
139 |
|
|
140 |
|
@Override |
141 |
|
public void actionPerformed(ActionEvent e) { |
142 |
|
cancelClose(); |
143 |
|
} |
144 |
|
}); |
145 |
|
} |
146 |
|
return cancelButton; |
147 |
|
} |
148 |
|
|
149 |
} |
} |