Due: Monday, October 11th at the beginning of class
Read: Koffman & Wolz, Chapter 7
import javax.swing.*;
import java.awt.*;
// add the appropriate import here
public class RandomColors extends JApplet // implement the right interface here
{
private JPanel colorPanel;
public void init()
{
JPanel buttonPanel;
buttonPanel = new JPanel(new FlowLayout());
colorPanel = new JPanel(new FlowLayout());
// create the button here
getContentPane().setLayout(new BorderLayout());
// add inner panels to the applet here
}
// add an event handler here
public Color makeRandomColor()
{
int red = (int)(Math.random() * 256);
int green = (int)(Math.random() * 256);
int blue = (int)(Math.random() * 256);
return new Color(red, green, blue);
}
}