int red = (int)(Math.random()*255); int green = (int)(Math.random()*255); int blue = (int)(Math.random()*255); Color randomColor = new Color(red,blue,green); g.setColor(randomColor); g.fillOval(70,70,100,100);
public void actionPerformed(ActionEvent e) { frame.repaint(); } }
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
Welcome to JavaRanch.
paintComponet
That's your problem - the method name is missing an "n". You may want to get in the habit of using the @Override annotation to avoid this kind of mistake.
Also, the packed frame isn't large enough for the circle to show up without resizing the frame. You may want to set the frame size specifically to a larger size and leave off the pack() call, or set the minimum and preferred size of the MyDrawPanel to a value that will take the size and location of the circle into account.
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.