import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class azione extends JFrame implements ActionListener
{
	JButton b;
	JPanel p;
	azione()
	{
		setTitle("prova");
		setSize(400,400);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		b = new JButton("bottone");
		b.addActionListener(this);
		p = new JPanel();
		p.add(b);
		add(p);
	}
	
	public void actionPerformed(ActionEvent e)
	{
		p.setBackground(new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255)));
	}
	
	public static void main(String[] a)
	{
		azione f = new azione();
		f.setVisible(true);
	}
}