Package editor

Source Code of editor.SchemePropertiesDialog

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 SchemePropertiesDialog extends SchemeDialog implements
    ActionListener {
  private static final long serialVersionUID = 1L;

  private JLabel lbDesc;
  private JTextArea taDesc;
  private JButton btOK,btCancel;
 
  public SchemePropertiesDialog(Frame owner,
      SchemeDialogListener schemeDialogListener) {
    super(owner,"Set descriptions...",schemeDialogListener);
    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);
  }

  public void setScheme(Scheme originalScheme) {
    super.setScheme(originalScheme);
    taDesc.setText(originalScheme.getDesc());
  }
 
  public void actionPerformed(ActionEvent ev) {
    if (ev.getSource() == btOK) {
      Scheme newScheme = new Scheme(originalScheme);
      newScheme.setDesc(taDesc.getText());
      dialogResult(newScheme);
      dialogDone();
    } else
    if (ev.getSource() == btCancel) {
      dialogCanceled();
    }
  }

}
TOP

Related Classes of editor.SchemePropertiesDialog

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.