【发布时间】:2018-02-06 06:09:41
【问题描述】:
我正在尝试绘制一个带有 for 循环的椭圆形,该循环遍历一个坐标列表,每个坐标列表都包含一个 x 值和 y 值。目前,在我启动程序后,它似乎没有绘制任何东西。第一次画,但是当我在程序运行时尝试画,它似乎没有画。
绘制代码如下:
private void render(){
bs = display.getCanvas().getBufferStrategy();
if(bs == null){
display.getCanvas().createBufferStrategy(3);
return;
}
g = bs.getDrawGraphics();
//Draw Here!
DrawGrid(g);
g.fillOval(100, 100, 10, 10);//this seems to draw
for(int i = 0; i < points.size();i++){//this doesn't draw....
System.out.println(points.get(i));
g.drawString(points.get(i).toString(), points.get(i).x*100-5+100, points.get(i).y-5-300);
g.fillOval(points.get(i).x*100-5+100, points.get(i).y-5-300, 10, 10);
}
//End Drawing!
bs.show();
g.dispose();
}
如果您需要更多详细信息,我使用的是 java.awt 库中的图形。另外,我过去也这样做过,但我不知道为什么这次不行。
【问题讨论】:
-
如需尽快获得更好的帮助,请发帖minimal reproducible example 或Short, Self Contained, Correct Example。