import java.awt.*;
import java.awt.event.*;
public class Ableitung extends Frame implements ActionListener
{
public double a,b,c,d;
private Button b1 = new Button("Berechenen"); // Button
private Label lb_fx = new Label();
private Label lb_x3 = new Label();
private Label lb_x2 = new Label();
private Label lb_x1 = new Label();
public Label lb_f1 = new Label();
public Label lb_f2 = new Label();
public Label lb_f3 = new Label();
private TextField tf_a = new TextField("0",40);
private TextField tf_b = new TextField("0",40);
private TextField tf_c = new TextField("0",40);
private TextField tf_d = new TextField("0",40);
private TextField tf_e = new TextField("0",40);
private TextField tf_f = new TextField("0",40);
double x = a+b;
public static void main(String args[])
{
Ableitung ab = new Ableitung();
}
// Konstruktor der Klasse
public Ableitung()
{
super("Ableitungsrechner");
setSize(500,200);
setLocation(100,100);
setVisible(true);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent event)
{
System.exit(0);
}
});
setLayout(null);
b1.setBounds(270,40,70,20);
lb_fx.setBounds(10,35,20,30);
tf_a.setBounds(35,40,25,20);
lb_x3.setBounds(65,40,40,20);
tf_b.setBounds(105,40,25,20);
lb_x2.setBounds(135,35,40,30);
tf_c.setBounds(175,40,25,20);
lb_x1.setBounds(205,35,25,30);
tf_d.setBounds(235,40,25,20);
lb_f1.setBounds(10,70,300,20);
lb_f2.setBounds(10,100,300,20);
lb_f3.setBounds(10,130,300,20);
lb_fx.setText("f(x)=");
lb_x3.setText("* x^3+");
lb_x2.setText("* x^2+");
lb_x1.setText("* x +");
lb_f1.setText(x+"");
lb_f2.setText("f''(x)=");
lb_f3.setText("f'''(x)=");
add(b1);
add(lb_fx);
add(tf_a);
add(lb_x3);
add(tf_b);
add(lb_x2);
add(tf_c);
add(lb_x1);
add(tf_d);
add(tf_f);
add(lb_f1);
add(lb_f2);
add(lb_f3);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
try{
a = Integer.valueOf(tf_a.getText()).intValue();
b = Integer.valueOf(tf_b.getText()).intValue();
c = Integer.valueOf(tf_c.getText()).intValue();
d = Integer.valueOf(tf_d.getText()).intValue();
}catch(Exception e){
System.out.println("Sie koennen nur Zahlen eingeben!");}
}
}
[quote][/quote]