import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;

public class h2_sort extends Applet implements ActionListener {

TextField t_f1, t_f2, t_f3, t_f4, t_f5, t_f6;
Button b_sort;

int hilf=0;
int zahl[]={0,0,0,0,0,0,0};

public void init() {
t_f1=new TextField("7",4);
t_f2=new TextField("8",4);
t_f3=new TextField("4",4);
t_f4=new TextField("2",4);
t_f5=new TextField("9",4);
t_f6=new TextField("3",4);
b_sort=new Button("Zum Sortieren bitte hier klicken");

this.add(t_f1);
this.add(t_f2);
this.add(t_f3);
this.add(t_f4);
this.add(t_f5);
this.add(t_f6);
add(b_sort);

t_f1.addActionListener(this);
t_f2.addActionListener(this);
t_f3.addActionListener(this);
t_f4.addActionListener(this);
t_f5.addActionListener(this);
t_f6.addActionListener(this);
b_sort.addActionListener(this);
}

public void actionPerformed(ActionEvent e) {

}


public void compute() {

for(int m=0;m<5;m++) {
for(int k=0;k<5;k++) {
if(zahl[k]>zahl[k+1]) {
hilf=zahl[k];
zahl[k]=zahl[k+1];
zahl[k+1]=hilf;
}
}
}
t_f1.setText(Integer.toString(zahl[0]));
t_f2.setText(Integer.toString(zahl[0]));
t_f3.setText(Integer.toString(zahl[0]));
t_f4.setText(Integer.toString(zahl[0]));
t_f5.setText(Integer.toString(zahl[0]));
t_f6.setText(Integer.toString(zahl[0]));
}

public void paint (Graphics g) {

Color grau = new Color(220,220,220);
g.setColor(Color.white);
g.fillRect(0,0,140,120);
g.setColor(grau);
g.drawRect(0,0,139,119);
g.setColor(Color.black);

}
}