現在、この関数を使用してボタンを作成および表示しています。
Button(String nm, int x, int y, int w, int h)
{
super(nm, x, y, w, h);
}
void display()
{
if(currentImage != null)
{
float imgWidth = (extents.y*currentImage.width)/currentImage.height;
pushStyle();
imageMode(CORNER);
tint(imageTint);
image(currentImage, pos.x, pos.y, imgWidth, extents.y);
stroke(bgColor);
noFill();
rect(pos.x, pos.y, imgWidth, extents.y);
noTint();
popStyle();
}
else
{
pushStyle();
stroke(lineColor);
fill(bgColor);
rect(pos.x, pos.y, extents.x, extents.y);
fill(lineColor);
textAlign(CENTER, CENTER);
text(name, pos.x + 0.5*extents.x, pos.y + 0.5* extents.y);
popStyle();
}
}
次のような関数を作成したいと思います: void hide() をクリックした後、必要なときに関数を削除または非表示にできるようにします。これにどのようにアプローチすればよいですか?基本的にすべてをnullに設定していますか?それを削除するには?