主题:Java画图问题,请高手指点~
小弟第一回用java,需要修改一个程序,把算出来的结果用图案表示出来,有些问题(可能很荒谬的问题),哪位高手指点指点啊(请详细一些,小弟对java基本上一窍不通。。。):
原来的主程序是:
public static void main(String[] args) {
Runtime runtime = Runtime.rccFactory(args);
//Load the State, Loads "input" if exists
RCCState state = new RCCState(runtime);
if(runtime.hasValue("input")){
state.parse(runtime.getFile("input"));
}
if(state.ready() ){
state.runProcedure();
}
else {
//printHeader(runtime);
System.exit(1);
}
其中state是记录运行结果的变量,我想加入一个函数 public void render(Graphics g)
用来画图,可不知道怎么使用在render函数中使用state的值,以下是我试过的方法,都不成:
1.在main函数前申明一个main和render公用的全局变量,把state中的值附给这个变量,可是eclipse显示:Cannot make a static reference to the non-static field dt。
2.将main(String[] args)改成main(String[] args, graphics g),画图版无显示。
3.将render(Graphics g)改成render((String[] args, graphics g),画图版无显示。
原来的主程序是:
public static void main(String[] args) {
Runtime runtime = Runtime.rccFactory(args);
//Load the State, Loads "input" if exists
RCCState state = new RCCState(runtime);
if(runtime.hasValue("input")){
state.parse(runtime.getFile("input"));
}
if(state.ready() ){
state.runProcedure();
}
else {
//printHeader(runtime);
System.exit(1);
}
其中state是记录运行结果的变量,我想加入一个函数 public void render(Graphics g)
用来画图,可不知道怎么使用在render函数中使用state的值,以下是我试过的方法,都不成:
1.在main函数前申明一个main和render公用的全局变量,把state中的值附给这个变量,可是eclipse显示:Cannot make a static reference to the non-static field dt。
2.将main(String[] args)改成main(String[] args, graphics g),画图版无显示。
3.将render(Graphics g)改成render((String[] args, graphics g),画图版无显示。