import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/* <applet code="HideShow.class" width="300" height="50"> </applet> */

public class HideShow extends JApplet implements ActionListener {
  JTextField input;
  JLabel lbl;
  JButton b1, b2;

  @Override
  public void init() {
    lbl  = new JLabel("label");
    input= new JTextField("text", 5);
    b1 = new JButton("Hide");
    b2 = new JButton("Show");
    b1.addActionListener(this);
    b2.addActionListener(this);
    setLayout(new FlowLayout());
    add(lbl); add(input); add(b1); add(b2);
  }

  public void actionPerformed(ActionEvent e) {
    if (e.getSource()==b1) {
      lbl.setVisible(false);  input.setVisible(false);  b1.setVisible(false);
    } else if (e.getSource()==b2) {
      lbl.setVisible(true);  input.setVisible(true);  b1.setVisible(true);
    }
    repaint();
  }
}
