import java.awt.*;import java.awt.event.*;import javax.swing.*;public class UseActionListener extends JFrame...{ Button OK; public UseActionListener() ...{ super("UseListener"); OK = new Button("change background"); MyListener listen = new MyListener(); OK.addActionListener(listen); this.getContentPane().add(OK); this.setSize(200,200); this.setVisible(true); } class MyListener implements ActionListener ...{ public void actionPerformed(ActionEvent action) ...{ //handle the event if(OK.getBackground().equals(Color.blue)) OK.setBackground(Color.orange); else OK.setBackground(Color.blue); } } public static void main(String args[])...{ new UseActionListener(); } }