1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
/* Hide Label Example This java example shows how to hide a label using setVisible method. */ import java.applet.Applet; import java.awt.Label; /* <applet code="HideLabelExample" width=100 height=200> </applet> */ public class HideLabelExample extends Applet{ public void init(){ //create labels Label label1 = new Label("Label 1"); Label label2 = new Label("Label 2"); //add labels add(label1); add(label2); /* * To hide a label, use * void setVisible(Boolean visible) * method. */ label2.setVisible(false); } } |
Example Output
Add Comment