package editor;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import engine.Scheme;
import engine.SchemeSet;
public class SchemeSetPropertiesDialog extends SchemeSetDialog implements
ActionListener {
private static final long serialVersionUID = 1L;
private JLabel lbDesc;
private JTextArea taDesc;
private JButton btOK,btCancel;
public SchemeSetPropertiesDialog(Frame owner,
SchemeSetDialogListener schemesetDialogListener) {
super(owner,"Set descriptions...",schemesetDialogListener);
this.getContentPane().setLayout(new GridLayout(3,3));
taDesc = new JTextArea();
this.getContentPane().add(taDesc);
btOK = new JButton("OK");
btOK.addActionListener(this);
this.getContentPane().add(btOK);
btCancel = new JButton("Cancel");
btCancel.addActionListener(this);
this.getContentPane().add(btCancel);
this.setSize(300,200);
}
@Override
public void setSchemeSet(SchemeSet originalSchemeSet) {
super.setSchemeSet(originalSchemeSet);
taDesc.setText(originalSchemeSet.getDesc());
}
public void actionPerformed(ActionEvent ev) {
if (ev.getSource() == btOK) {
SchemeSet newSchemeSet = new SchemeSet(originalSchemeSet);
newSchemeSet.setDesc(taDesc.getText());
dialogResult(newSchemeSet);
dialogDone();
} else
if (ev.getSource() == btCancel) {
dialogCanceled();
}
}
}