import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Sorteren extends JFrame 
    implements ActionListener {

    JTextField tekstveld1,tekstveld2,tekstveld3;
    int getal1, getal2, getal3;
    JButton knop;

    public static void main(String[] args) {
    	
        Sorteren frame = new Sorteren();
        frame.setSize(200, 200);
        frame.createGUI();
        frame.show();
    }

    private void createGUI() {
    	
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        Container window = getContentPane();
        window.setLayout(new FlowLayout());
            
        tekstveld1 = new JTextField(10);
        window.add(tekstveld1);
        
        tekstveld2 = new JTextField(10);
        window.add(tekstveld2);
        
        tekstveld3 = new JTextField(10);
        window.add(tekstveld3);
        
           
        knop = new JButton("Sorteren");
        window.add(knop);
        knop.addActionListener(this);
        
        
        
    }

    public void actionPerformed(ActionEvent event) {
    	
    	getal1 = Integer.parseInt(tekstveld1.getText());
    	getal2 = Integer.parseInt(tekstveld2.getText());
    	getal3 = Integer.parseInt(tekstveld3.getText());
    	
    		
    	if (getal1 > getal2 && getal1 > getal3) {

			tekstveld1.setText(getal1+"");

				if (getal2 > getal3) {

					tekstveld2.setText(getal2+"");
					tekstveld3.setText(getal3+"");
					
				} else {
					
					tekstveld2.setText(getal3+"");
					tekstveld3.setText(getal2+"");							
				}	
		} 
		
				
    	if (getal2 > getal1 && getal2 > getal3) {

			tekstveld1.setText(getal2+"");

				if (getal1 > getal3) {

					tekstveld2.setText(getal1+"");
					tekstveld3.setText(getal3+"");
					
				} else {
					
					tekstveld2.setText(getal3+"");
					tekstveld3.setText(getal1+"");				
				}				
		} 
		
				
    	if (getal3 > getal1 && getal3 > getal2) {

			tekstveld1.setText(getal3+"");

				if (getal1 > getal2) {

					tekstveld2.setText(getal1+"");
					tekstveld3.setText(getal2+"");
					
				} else {
					
					tekstveld2.setText(getal2+"");
					tekstveld3.setText(getal1+"");					
				}						
		}            
       	
        
    }
}

