JLabel, JButton Example
The JApplet class provides a Container contentPane.This has a Layout Manager (FlowLayout by default), and components such as buttons and labels can be added to it.
// JLabel JButton Applet Example
import java.awt.*;
import javax.swing.*;
class JLabelJButtonExample extends JApplet {
@Override public void init() {
Container cp = getContentPane();
cp.add(new JLabel("JLabel for applet"));
cp.add(new JButton("JButton for applet"));
}
}
