82 lines
1.8 KiB
Java
82 lines
1.8 KiB
Java
|
package velamentum;
|
||
|
|
||
|
import javax.swing.JFrame;
|
||
|
import javax.swing.JOptionPane;
|
||
|
|
||
|
public class EntscheidungsDialog extends Dialog {
|
||
|
|
||
|
private int ergebnis = 0;
|
||
|
private String text1 = "Ja";
|
||
|
private String text2 = "Nein";
|
||
|
private String text3 = "Vielleicht";
|
||
|
private boolean dreiTasten = false;
|
||
|
|
||
|
|
||
|
public EntscheidungsDialog(String pTitel, String pNachricht) {
|
||
|
super(pTitel, pNachricht);
|
||
|
// TODO Auto-generated constructor stub
|
||
|
}
|
||
|
|
||
|
public void setzeText1(String pText) {
|
||
|
this.text1 = pText;
|
||
|
}
|
||
|
|
||
|
public void setzeText2(String pText) {
|
||
|
this.text2 = pText;
|
||
|
}
|
||
|
|
||
|
public void setzeText3(String pText) {
|
||
|
this.text3 = pText;
|
||
|
}
|
||
|
|
||
|
public void setzeErgebnisA() {
|
||
|
this.ergebnis = 1;
|
||
|
}
|
||
|
|
||
|
public void setzeErgebnisB() {
|
||
|
this.ergebnis = 2;
|
||
|
}
|
||
|
|
||
|
public void setzeErgebnisC() {
|
||
|
this.ergebnis = 3;
|
||
|
}
|
||
|
|
||
|
public void setzeDreiTasten(boolean pDreiTasten) {
|
||
|
this.dreiTasten = pDreiTasten;
|
||
|
}
|
||
|
|
||
|
public int nenneErgebnis() {
|
||
|
return this.ergebnis;
|
||
|
}
|
||
|
|
||
|
public String nenneText1() {
|
||
|
return this.text1;
|
||
|
}
|
||
|
|
||
|
public String nenneText2() {
|
||
|
return this.text2;
|
||
|
}
|
||
|
|
||
|
public String nenneText3() {
|
||
|
return this.text3;
|
||
|
}
|
||
|
|
||
|
public boolean nenneDreiTasten() {
|
||
|
return this.dreiTasten;
|
||
|
}
|
||
|
|
||
|
public void zeige() {
|
||
|
JFrame desk = new JFrame();
|
||
|
if(this.dreiTasten) {
|
||
|
Object[] options = {this.text1, this.text2, this.text3};
|
||
|
this.ergebnis = JOptionPane.showOptionDialog(desk, this.nenneNachricht(), this.nenneTitel(), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0])+1;
|
||
|
}else if(!this.dreiTasten) {
|
||
|
Object[] options = {this.text1, this.text2};
|
||
|
this.ergebnis = JOptionPane.showOptionDialog(desk, this.nenneNachricht(), this.nenneTitel(), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0])+1;
|
||
|
}else {
|
||
|
System.out.println("Bei zeige() hat die Fallunterscheidung nicht geklappt!");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|