summaryrefslogtreecommitdiff
path: root/src/TestApplet.java
blob: cba1811845c7a4547d73e9f5eefd97c58a82e79f (plain)
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
import javax.swing.*;          //This is the final package name.
//import com.sun.java.swing.*; //Used by JDK 1.2 Beta 4 and all
                               //Swing releases before Swing 1.1 Beta 3.
import java.awt.*;

public class TestApplet extends JApplet {

    // This is a hack to avoid an ugly error message in 1.1.
    public TestApplet() {
        getRootPane().putClientProperty("defeatSystemEventQueueCheck",
                                        Boolean.TRUE);
    }

    public void init() {
        JLabel label = new JLabel(
                           "You are successfully running a Swing applet!");
        label.setHorizontalAlignment(JLabel.CENTER);

        //Add border.  Should use createLineBorder, but then the bottom
        //and left lines don't appear -- seems to be an off-by-one error.
        label.setBorder(BorderFactory.createMatteBorder(1,1,2,2,Color.black));

        getContentPane().add(label, BorderLayout.CENTER);
    }
}