Simple JApplet

You should see an applet above that allows you to type something into the textbox and then click on the button to copy it into the label.

The source code

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

public class ADemo1 extends JApplet {
   JLabel lbl = new JLabel();
   JTextField txt = new JTextField();
   JButton btn = new JButton("Click Me!");

   public void init() {
      Container c = getContentPane();
      c.setLayout(new GridLayout(3,1,5,5));
      c.add(txt);
      c.add(lbl);
      c.add(btn);
      btn.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
            if (txt.getText().length() > 0) {
               lbl.setText(txt.getText());
               txt.setText("");
            }
         }
      });
   }
}