import java.awt.*;
import java.applet.*;
import javax.swing.*;
public class SwingCubScout extends Applet {
public void init() {
JLabel cubScouts = new JLabel("Cub Scouts!");
cubScouts.setForeground(Color.blue);
cubScouts.setBackground(Color.yellow);
cubScouts.setFont(new Font("Sans", Font.BOLD, 24));
this.add(cubScouts);
}
}
This is almost identical to the AWT-based Cub Scout applet,
except that I've imported the javax.swing
package
and changed Label
to JLabel
.