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

新手求教,看看哪里不对,编译没问题,可结果不对
看马老师的视屏,跟着做不知道哪错了
求前辈看看
import java.awt.*;

public class TestPaint {

public static void main(String[] args) {
new PaintFrame().launchFrame();
}

}

class PaintFrame extends Frame {

public void launchFrame() {
setBounds(100,100,600,600);
setVisible(true);
}

public void Paint(Graphics g) {
Color c = g.getColor();
g.setColor(Color.red);
g.fillOval(30, 30, 30, 30);
g.setColor(Color.black);
g.fillRect(100, 100, 30, 30);
g.setColor(c);
}
}
应该出来矩形和圆的,可是没有,和马老师的代码一样。可就是出不来,编译木问题,哪有问题的?
------解决方案--------------------
public void Paint(Graphics g) {
这一行的Paint改为paint。
------解决方案--------------------
引用:
public void Paint(Graphics g) {
这一行的Paint改为paint。


ls正解!