import java.awt.*;import java.awt.event.*;import javax.swing.*;class RoughDraw extends Canvas{private static final int PROMT_X=20;private static final int PROMT_Y=90;public void paint(Graphics g){String prompt=new String("This is a canvas!");setForeground(Color.black);g.setFont(new font(null,Font.CENTER_BASELINE,20));g.drawString(prompt,PROMT_X,PROMT_Y);}}public class MyFirstFrame extends Frame{private static final int FRAME_WIDTH= 450;private static final int FRAME_HEIGHT=300 ;private static final int FRAME_X_ORIGIN=150 ;private static final int FRAME_Y_ORIGIN= 250;private static final int CANVAS_X_POS=10 ;private static final int CANVAS_Y_POS= 40;private static final int CANVAS_WIDTH=430 ;private static final int CANVAS_HEIGHT= 180;private static final int BUTTON_X_POS=120 ;private static final int BUTTON_Y_POS=245 ;private static final int BUTTON_WIDTH=60 ;private static final int BUTTON_HEIGHT=30 ;private JButton ok,cancel;public MyFirstFrame(){setTitle("MyFirstFrame");setLayout(null);setLocation(FRAME_X_ORIGIN,FRAME_Y_ORIGIN);setSize(FRAME_WIDTH,FRAME_HEIGHT);setResizable(false);setBackground(Color.lightGray);RoughDraw figure=new RountDraw();figure.setLocation(CANVAS_X_POS,CANVAS_Y_POS);figure.setSize(CANVAS_WIDTH,CANVAS_HEIGHT);figure.setBackground(Color.white);add(figure);ok=new JButton("OK");ok.setLocation(BUTTON_X_POS,BUTTON_Y_POS);ok.setSize(BUTTON_WIDTH,BUTTON_HEIGHT);add(ok);cancel=new JButton("Cancel");cancel.setLocation(BUTTON_X_POS+160,BUTTON_Y_POS);cancel.setSize(BUTTON_WIDTH,BUTTON_HEIGHT);add(cancel);}public static void main(String args[]){ MyFristFrame mf=new MyFristFrame();mf.setVisible(true);mf.addWindowListener(new WindowAdapter(){ public void windowClosing(windowEvent ev){System.exit(0);}});}}编译找不到系统方法,JDK1.5.0, 编辑器JCreator~~~跪求答案
參考答案:你代码里的错误纯粹是拼写和大小写的错误。
依照编译器的信息你一定可以把它们都纠正过来。
另外,JCreator 是集成开发环境,不是编译器。