我需要做一个循环与paintComponent
Java的涂料成份环
像这样
public class Screen extends JComponent
{
public void paintComponent(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
g.fillOval(Main.x, Main.y, 20, 20);
}
{
for(int c = 0; c<10; c++)
{
paintComponent(g);
}
}
的方法是在扩展JComponent
类。
在for循环的Java给我一个错误
g
不能被解析为一个变量
任何人都可以帮助吗?
谢谢!
请问您可以发布完整的代码片段,例如'for'循环本身并不意味着什么,周围代码在'for'循环中的位置会给我们更清晰的图片 – 2015-04-02 11:07:59
我发布了,这是一个非常小的类 – thevilcode 2015-04-02 11:13:49
它只是paintComponent方法和for循环 – thevilcode 2015-04-02 11:15:05