/*
Hide Button Example
This java example shows how to hide a Button using setVisible method.
*/
import java.applet.Applet;
import java.awt.Button;
/*
<applet code="HideButtonExample" width=100 height=200>
</applet>
*/
public class HideButtonExample extends Applet{
public void init(){
//create Buttons
Button Button1 = new Button("Ok");
Button Button2 = new Button("Cancel");
//add Buttons
add(Button1);
add(Button2);
/*
* To hide a Button, use
* void setVisible(Boolean visible)
* method.
*/
Button2.setVisible(false);
}
}
Example Output

Bookmark/Search this post with: