01: package vicazh.hyperpool;
02:
03: import javax.swing.*;
04: import java.awt.event.*;
05: import java.beans.*;
06:
07: /**
08: * The graphic about dialog
09: * @author Victor Zhigunov
10: * @version 0.2.0
11: */
12: public class IAbout implements ActionListener, PropertyChangeListener {
13: private JDialog dialog;
14: private JOptionPane optionPane;
15:
16: /**
17: * @param dialog about dialog
18: */
19: public IAbout(JDialog dialog) {
20: this .dialog = dialog;
21: optionPane = (JOptionPane) dialog.getContentPane();
22: optionPane.addPropertyChangeListener(this );
23: }
24:
25: public void actionPerformed(ActionEvent e) {
26: dialog.setLocationRelativeTo(dialog.getOwner());
27: dialog.setVisible(true);
28: Object value = optionPane.getValue();
29: if (value == JOptionPane.UNINITIALIZED_VALUE)
30: return;
31: optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
32: }
33:
34: public void propertyChange(PropertyChangeEvent e) {
35: String prop = e.getPropertyName();
36: if (dialog.isVisible()
37: && (e.getSource() == optionPane)
38: && (prop.equals(JOptionPane.VALUE_PROPERTY) || prop
39: .equals(JOptionPane.INPUT_VALUE_PROPERTY)))
40: dialog.setVisible(false);
41: }
42: }
|