// HelloSwingJApplet.java (c) 2005 Kari Laitinen // 2006-01-21 File created. // 2006-01-21 Latest modification. // This is an example of a very simple Java applet. // This is a swing version of HelloApplet.java import java.awt.* ; import javax.swing.* ; class HelloPanel extends JPanel { public void paintComponent( Graphics graphics ) { // The superclass version of paintComponent() clears the // component area and does other necessary things. super.paintComponent( graphics ) ; graphics.drawString( "Hello. I am a Java applet.", 80, 100 ) ; graphics.drawString( "The coordinates of this line are (80,150).", 80, 150 ) ; } } public class HelloSwingJApplet extends JApplet { public void init() { Container content_pane_of_this_applet = getContentPane() ; HelloPanel main_panel_of_this_applet = new HelloPanel() ; content_pane_of_this_applet.add( main_panel_of_this_applet ) ; } } /* The above init() method can alternatively be written in the following way: public void init() { getContentPane().add( new HelloPanel() ) ; } ****/