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