Adam Lipowski





import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class startstop1 extends Applet implements ActionListener {
    Button b1 = new Button("Start");
    Button b2 =new Button("Prawo");
    Label la,tytul;
    public void init(){          
       la=new Label("Nacisnij przycisk");
       la.setFont(new Font("Helvetica",Font.BOLD,30));
       la.setAlignment(Label.CENTER);
       setLayout(new BorderLayout());
       tytul= new Label("Aplet start/stop-prawy/lewy");
       tytul.setAlignment(Label.CENTER);
       b1.setBackground(Color.red);
       add("North",tytul);
       add("Center",la);
       add("West",b1);
       add("East",b2);
       b1.addActionListener(this);
       b2.addActionListener(this);
    }
    public void actionPerformed(ActionEvent e){
        String txt;
    if(e.getSource()==b1){
       if(b1.getLabel()=="Stop"){
          b1.setLabel("Start");
       }
       else{
           b1.setLabel("Stop");
       }  
       la.setText("nacisnales 1");
    }
    else{
       if(b2.getLabel()=="Prawo"){
          b2.setLabel("Lewo");
       }
       else{
           b2.setLabel("Prawo");
       }  
       la.setText("nacisnales 2");
    }
    }
}