/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ import java.awt.Color; import java.awt.Graphics; import javax.swing.JApplet; import javax.swing.JPanel; public class SwingHelloWorld2 extends JApplet { public void init() { JPanel p = new MyPannel(); add(p); } } class MyPannel extends JPanel { public void paintComponent( Graphics g ) { setBackground( Color.blue ); setForeground( Color.yellow ); super.paintComponent(g); g.drawString( "Hello World!", 25, 25 ); } }