为什么这不会在窗口中显示我的圆圈?

时间:2015-11-08 22:41:34

标签: java swing

我正在尝试向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);

}
  }

0 个答案:

没有答案