0
class Robot extends Canvas
{
public Robot() //constructor method - sets up the class
{
setSize(800,600);
setBackground(Color.WHITE);
setVisible(true);
}
public void paint(Graphics window)
{
window.setColor(Color.BLUE);
window.drawString("Robot LAB ", 35, 35);
//call head method
//call other methods
}
public void head(Graphics window)
{
window.setColor(Color.YELLOW);
window.fillRect(300, 100, 200, 100);
//add more code here
}
我该如何称呼头部方法?带参数的呼叫方法
我试过多次,但我似乎无法得到它。
head(); window.head();没有为我工作?
对不起,我对此很新。
'head(window);'? – Thilo 2014-12-05 00:49:28
谢谢!头(窗口);为我工作,但我可以知道你为什么把窗口放在括号内?括号内通常会出现什么内容? – prora 2014-12-05 00:51:24