I am kind of confused about how applet works so, I am appealing for some explinations from any good sumariton with Applets savy. Here is what I have done so far but, I still cant get the faults to stop and get mycodes to work.
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List.*;
import javax.swing.*;
public class JEraseImage extends JApplet implements ActionListener
{
ImageIcon image = new ImageIcon("event.gif");
JButton press = new JButton("Press");
List<Rectangle> list = new ArrayList<Rectangle>();
int width = 10;
int height = 10;
int startPosX = 10;
int startPosY = 10;
int imageWidth, imageHeight;
public void init ()
{
Container con = getContentPane();
con.setLayout(new BorderLayout() );
press.addActionListener(this);
con.add(press, "South");
imageWidth = Image.getIconWidth();
imageHeight = Image.getIconHeight();
}
list.add Rectangle;
repaint();
public void paint(Graphics g)
{
super.paint(g);
g.drawImage(image.getImage(), 10, 10, this);
for (int count = 0; count <20; ++count)
{
int X = (int) (Math.random() * imageWidth) + startPosX;
int Y = (int) (Math.random() * imageHeight) + startPosY;
g.fillOvals(X, Y, 10, 10);
}
}
}