hi.. i am new to gui and i have some trouble.
i'm trying to create button that change background color to random color.
this is what i have done:

import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.Random;
import javax.swing.*;
 
 
public class Mainp extends JFrame 
{	
private ImageIcon image1;
private JLabel label1;
private JButton startbutton;
 
 
public void rndbackground()
{
Random rand = new Random();
float r = rand.nextFloat();
float g = rand.nextFloat();
float b = rand.nextFloat();
Color randomcolor=new Color(r,g,b);
getContentPane().setBackground(randomcolor); 
}
 
public void creation() 
{
	setLayout(new FlowLayout());
	image1= new ImageIcon(getClass().getResource("sun_2.png"));
	label1=new JLabel(image1);
	startbutton = new JButton("Start");
	add(label1);
	add(startbutton);
}
 
Mainp()
{
creation();
rndbackground();
}
 
public static void main(String[] args)
{
Mainp gui= new Mainp();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setVisible(true);
gui.pack();
gui.setTitle("title");
}
}


when i change
public class Mainp extends JFrame
to
public class Mainp extends JFrame implements ActionListener
it make errors and doesn't recognize it.. what to do?