i want to fill my oval (circle) with more ovals (circles), but the problem is that all i get is a line. I have already tried every solution that google offers but non worked. All i want to do is to fill my red circles with green circles, but i want them to stop by the boundary.
i use this code in JAVA :
package forexam1;
import java.lang.Object;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import java.math.*;
public class exam1 extends JFrame
{
public exam1()
{
setTitle("Triangle");
setSize(400,400);
setVisible(true);
}
public void boundaryFill(double x, double y, Color BC, Color FC , Graphics s)
{
Color CC = Color.white;
if ((CC != BC) && (CC != FC))
{
s.setColor(FC);
s.drawOval((int)x , (int)y , 1 , 1);
boundaryFill(x+1 , y , FC , BC , s);
boundaryFill(x-1 , y , FC , BC , s);
boundaryFill(x , y+1 , FC , BC , s);
boundaryFill(x , y-1 , FC , BC , s);
}
}
public void paint( Graphics g )
{
double x=200,y=200;
Color FC = Color.GREEN;
Color BC = Color.RED;
g.setColor(BC);
g.drawOval(100, 100, 200, 200);
boundaryFill(x , y , FC , BC , g);
}
public static void main(String[] args)
{
new exam1();
}
}