源代码:
package box;
import java.util.Random;
import java.awt.Color;
import java.awt.Graphics;
public class PaintableRect extends Rect{
int r;
int g;
int b;
public PaintableRect(){
}
public PaintableRect(int r,int g,int b){
this(0,0,0,0,r,g,b);
}
public PaintableRect(int x,int y,int w,int h,int r,int g,int b){
super(x,y,w,h);
this.r=r;
this.g=g;
this.b=b;
}
public void setColor(int r,int g,int b){
this.r=r;
this.g=g;
this.b=b;
}
public int getRed(){
return r;
}
public int getBlue(){
return b;
}
public int getGreen(){
return g;
}
public String toString(){
String str = super.toString();
str= str+",r="+r+",g="+g+",b="+b;
return str;
}
public void paint(Graphics g){
g.setColor(new Color(35,31,32));
g.fillRect(x, y, width, height);
}
public void randomColor(){
int r=RandomUtils.nextInt(255);
int g=RandomUtils.nextInt(255);
int b=RandomUtils.nextInt(255);
}
}
为什么一直提示说RandomUtils cannot be resolved
答案:2 mip版
解决时间 2021-01-17 17:58
- 提问者网友:时光盗走我的心
- 2021-01-16 18:47
最佳答案
- 二级知识专家网友:清欢话寂寥
- 2021-01-16 19:14
RandomUtils这个类不是系统自带的类,应该是第三者封装的,你直接把代码复制过来了,而这个类你没有复制过来,导致找不到这个类。
全部回答
- 1楼网友:那年夏天
- 2021-01-16 19:30
搜一下:为什么一直提示说RandomUtils cannot be resolved
我要举报
如以上问答内容为低俗/色情/暴力/不良/侵权的信息,可以点下面链接进行举报,我们会做出相应处理,感谢你的支持!
点此我要举报以上问答信息
推荐资讯