日期:2014-05-20  浏览次数:20797 次

初学JAVA的一段代码,看不出哪里出错,帮忙检查下
Java code
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JApplet;



public class definemethod extends JApplet{
    public void paint(Graphics g){
        super.paint(g);
        myDraw(g, 50, 50, 20);
        
    }
    
    public myDraw(Graphics gg, int centex, int centey, int radius)
    {
        gg.drawOval(centex - radius, centey - radius, 2 * radius, 2 * radius);
    }

}




************************************************************

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)


------解决方案--------------------
我汗,你要细心呀
------解决方案--------------------
//声明一个方法的格式:修饰符 返回值 方法名(参数类型 参数名 ...) 
public void myDraw(Graphics gg, int centex, int centey, int radius)
------解决方案--------------------
原来是C++过来的mm,失敬失敬