Here is an example of my problem, this code does draw:
while this doesn't:Code:public static void paint(Graphics g, Ball2 balls, int startX,int imWidth, int endY, Image img, Object ths ){ for(int i = 0;i<balls.getBallPositionsArr().length/2;i++){ //g.setColor (0xffffcc); //g.fillRoundRect( (int)(balls.getX(i) - balls.getRadius())-2, (int)(balls.getY(i) - balls.getRadius())-2, (int) balls.getRadius()+4, (int) balls.getRadius()+4,1,1); g.setColor (0xffffcc); g.fillRect(20, 20, 50, 10); } g.setColor (0xffffcc); g.fillRect(20, 20, 50, 10); }
Code:public static void paint(Graphics g, Ball2 balls, int startX,int imWidth, int endY, Image img, Object ths ){ for(int i = 0;i<balls.getBallPositionsArr().length/2;i++){ //g.setColor (0xffffcc); //g.fillRoundRect( (int)(balls.getX(i) - balls.getRadius())-2, (int)(balls.getY(i) - balls.getRadius())-2, (int) balls.getRadius()+4, (int) balls.getRadius()+4,1,1); g.setColor (0xffffcc); g.fillRect(20, 20, 50, 10); } }
Why the last piece of code, which shall draw to "g" in a loop doesn't do what's expected? How can I fix it?
In Java SE both work.

Reply With Quote

