相关疑难解决方法(0)

int无法解除引用

我开始在java(我正在学习microedition),我得到了这个错误:"int无法取消引用"在下面的类中:

class DCanvas extends Canvas{
    public DCanvas(){

    }

    public void drawString(String str, int x, int y, int r, int g, int b){
        g.setColor(r, g, b); //The error is here
        g.drawString(str, x, y, 0); //and here
    }

    public void paint(Graphics g){
        g.setColor(100, 100, 220);
        g.fillRect(0, 0, getWidth(), getHeight());
    }
}
Run Code Online (Sandbox Code Playgroud)

我在这做错了什么?好吧,我来自PHP和ECMAScripts,我能够以这种方式传递我的函数参数,所以我真的不明白这个错误.

java java-me

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×1

java-me ×1