似乎无法调用或创建特定方法drawAll()?

时间:2016-10-20 14:23:40

标签: java methods

我很困惑,在我的项目的最后一步,任何人都可以解释这是第一部分。说明没有告诉我创建一个drawAll()方法所以我认为它是一个图形方法,但它没有出现在oracle上?我是新程序员的帮助表示赞赏。感谢

import java.awt.*;
public class Project2 {
  public static final int PANEL_WIDTH = 300;
  public static final int PANEL_HEIGHT = 300;
  public static final int SLEEP_TIME = 50;
 public static void main(String[] args) {
    DrawingPanel panel = new DrawingPanel(PANEL_WIDTH, PANEL_HEIGHT);
    Graphics g = panel.getGraphics( );
    startGame(panel, g);
  }

  public static void startGame(DrawingPanel panel, Graphics g) {

    for (int i = 0; i <= 10000; i++) {
      panel.sleep(SLEEP_TIME);
      drawAll(g);

    }
  }
}

        Process p = new Process();
            p.StartInfo.FileName = Directory.GetCurrentDirectory() + @"test.bin";
            p.StartInfo.UseShellExecute = false;
            p.Start();

1 个答案:

答案 0 :(得分:1)

public static void drawAll(Graphics g)
{
    g.drawString("Project 2 by NAMEHERE", 1,15);
}

public static void startGame(DrawingPanel panel, Graphics g) 
{
    //start startGame
    for (int i = 0; i <= 10000; i++) {
        panel.sleep(SLEEP_TIME);
        drawAll(g);
    }
} //end main game