我尝试运行以下源但得到
类型不匹配:无法从 CustomJPan 转换为 JPanel
错误。有人可以帮忙吗?请原谅消息来源,我是从头顶上做的。
public class rebuiltgui extends JApplet {
public void init() {
JPanel jpan = new CustomJPan();
}
}
class CustomJPan {
public JPanel CustomJPan() {
thispan = new JPanel();
thispan.setBackground( Color.red );
return thispan;
}
public changeColour() {
// Change colour to blue here
}
}