import java.lang.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Definition1 extends JFrame implements ActionListener {
private JLabel l;
private JComboBox[] ;
private JButton bu1;
private JTextField tf;
public Definition1(String t) {
Haup(t);
this.setLayout(new BorderLayout());
l = new JLabel("Wert"); this.add(l,BorderLayout.WEST);
tf = new JTextField(10);
String []cb = new String[]{"Wurzel","Quadrat"};
bu1 = new JButton("ok");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.pack();
this.show();
bu1.setActionCommand("A");
cb.getSource();
}
public double Wurzel(double x){
double w = Math.sqrt(x);
return w;
}
public double Quadrat(double y){
double q = Math.pow(y,2);
return q;
}
public double Kon(String z){
double k = valueOf(z);
return k;
}
public void actionPerformed(ActionEvent e){
String strTemp = cb.getSelectedItem().toString;
if(e.getActionCommand().equals("A")){
if(strTemp.equals("Wurzel")){
Wurzel();}
else if(strTemp.equals("Quadrat")){
Quadrat;
this.dispose();
}
}
}