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);
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.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java