org.hwo.pulscounter/src/org/hwo/pulscounter/ui/SimpleScriptElementEditor.java

81 lines
2.0 KiB
Java

package org.hwo.pulscounter.ui;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import org.hwo.pulscounter.simplescript.SimpleScript.SimpleScriptElement;
import java.awt.Dialog.ModalExclusionType;
import java.awt.Dialog.ModalityType;
public class SimpleScriptElementEditor extends JDialog {
public static boolean show(Component parent,SimpleScriptElement simpleScriptElement){
return false;
}
private SimpleScriptElement simpleScriptElement;
private boolean accepted;
private final JPanel contentPanel = new JPanel();
/**
* Create the dialog.
*/
public SimpleScriptElementEditor() {
setTitle("Skriptelement bearbeiten");
setModalityType(ModalityType.APPLICATION_MODAL);
setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
setBounds(100, 100, 519, 370);
getContentPane().setLayout(new BorderLayout());
contentPanel.setLayout(new FlowLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
}
public SimpleScriptElement getSimpleScriptElement() {
return simpleScriptElement;
}
public void setSimpleScriptElement(SimpleScriptElement simpleScriptElement) {
this.simpleScriptElement = simpleScriptElement;
}
private void accept(){
accepted = true;
setVisible(false);
}
private void cancel(){
setVisible(false);
}
public boolean isAccepted() {
return accepted;
}
}