我正在尝试向jframe绘制一个圆圈,但是我遇到了错误。我的代码出了什么问题?
import java.awt.Graphics;
import java.awt.Color;
import javax.swing.JFrame;
public class Racing {
public static void main (String[]args) {
Racing r = new Racing();
r.graphics(null);
}
public void graphics(Graphics g) {
g.setColor(Color.GREEN);
g.drawOval(480,480,200,200);
}
public Racing(){
JFrame frame = new JFrame("Infinite race");
frame.setVisible(true);
frame.setLocationRelativeTo(null);
frame.setSize(960, 960);
}
}