next next up down toc Memos schedule allInOne PDF PDF mail
all, section 16.

16.  Applets

Extends JApplet

implement init ....

Source: Src/22/HelloSwingApplet.java.minusSTART_STOP


 1      import javax.swing.*;          //This is the final package name.
 2      //import com.sun.java.swing.*; //Used by JDK 1.2 Beta 4 and all
 3                                     //Swing releases before Swing 1.1 Beta 3.
 4      import java.awt.*;
 5      
 6      public class HelloSwingApplet extends JApplet {
 7      
 8          // This is a hack to avoid an ugly error message in 1.1.
 9          public HelloSwingApplet() {
10              getRootPane().putClientProperty("defeatSystemEventQueueCheck",
11                                              Boolean.TRUE);
12          }
13      
14          public void init() {
15              JLabel label = new JLabel(
16                                 "Hi successfully running a Swing applet!");
17              label.setHorizontalAlignment(JLabel.CENTER);
18      
19              //Add border.  Should use createLineBorder, but then the bottom
20              //and left lines don't appear -- seems to be an off-by-one error.
21              label.setBorder(BorderFactory.createMatteBorder(1,1,2,2,Color.black));
22      
23              getContentPane().add(label, BorderLayout.CENTER);
24          }
25      }

Source Code: Src/22/HelloSwingApplet.java

You may see it here.


back next up down toc Memos schedule allInOne pdf PDF mail

Created by unroff, java2html & & hp-tools. © by csfac. All Rights Reserved (2010).
It is not allowed to print these pages on a CAST printer.
Last modified: 01/April/10 (17:16)