Write an applet that contains one button. Initialize the label on the button to “Start”. Toggle the button label between these two values each time the button is pressed.

import java.applet.Applet;
import java.awt.Button;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.text.AbstractDocument.BranchElement;

import com.sun.corba.se.impl.orbutil.graph.Graph;

public class appletbtn extends Applet implements ActionListener
{
    public appletbtn() {
    }

    Button btn;
    String Label = "Start";
    String Label2 = "Changed";
   
    @Override
    public void init()
    {
        setLayout(null);

        btn = new Button(Label);
        btn.setBounds(10, 57, 167, 82);
       
        this.add(btn);
        btn.addActionListener(this);
    }
 
    private boolean isLabel()
    {
        if(btn.getLabel().equalsIgnoreCase(Label))
            return true;
        return false;
       
    }
   
    @Override
    public void actionPerformed(ActionEvent e)
    {
        if(e.getSource() == btn)
        {
            if(isLabel())
                btn.setLabel(Label2);
            else
                btn.setLabel(Label);
           
        }
       
    }
   
}