package vicazh.hyperpool;
import javax.swing.*;
import java.awt.event.*;
import java.beans.*;
/**
* The graphic about dialog
* @author Victor Zhigunov
* @version 0.2.0
*/
public class IAbout implements ActionListener, PropertyChangeListener {
private JDialog dialog;
private JOptionPane optionPane;
/**
* @param dialog about dialog
*/
public IAbout(JDialog dialog) {
this.dialog = dialog;
optionPane = (JOptionPane) dialog.getContentPane();
optionPane.addPropertyChangeListener(this);
}
public void actionPerformed(ActionEvent e) {
dialog.setLocationRelativeTo(dialog.getOwner());
dialog.setVisible(true);
Object value = optionPane.getValue();
if (value == JOptionPane.UNINITIALIZED_VALUE)
return;
optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
}
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if (dialog.isVisible()
&& (e.getSource() == optionPane)
&& (prop.equals(JOptionPane.VALUE_PROPERTY)
|| prop.equals(JOptionPane.INPUT_VALUE_PROPERTY)))
dialog.setVisible(false);
}
}
|