diff options
author | Pixel <Pixel> | 2001-11-19 14:14:53 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2001-11-19 14:14:53 +0000 |
commit | d994b63efc388311700412d0cb0e6e8e1fae4849 (patch) | |
tree | 25067e547ad1fbbfa1242c190804dacb0d3258ae /src/HelloSwingApplet.java | |
parent | e9b67be232643791e278a909b2acf193ff1a0225 (diff) |
Testing java applet compilation
Diffstat (limited to 'src/HelloSwingApplet.java')
-rw-r--r-- | src/HelloSwingApplet.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/HelloSwingApplet.java b/src/HelloSwingApplet.java new file mode 100644 index 0000000..1a6a436 --- /dev/null +++ b/src/HelloSwingApplet.java @@ -0,0 +1,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 HelloSwingApplet extends JApplet { + + // This is a hack to avoid an ugly error message in 1.1. + public HelloSwingApplet() { + 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); + } +} |