Source of HelloFromVenus.java


  1: /* 
  2:  * Copyright (c) 1999-2002, Xiaoping Jia.  
  3:  * All Rights Reserved. 
  4:  */
  5: 
  6: import java.awt.*;
  7: import java.applet.Applet;
  8: 
  9: /**
 10:  *  A simple Java applet. It displays the greeting message "Hello from Venus!" graphically. 
 11:  *  It consists of a text message and an image of the planet Venus. 
 12:  */
 13: public class HelloFromVenus extends Applet {
 14: 
 15:   public void paint(Graphics g) {
 16:     Dimension d = getSize();
 17:     g.setColor(Color.black);
 18:     g.fillRect(0,0,d.width,d.height);
 19:     g.setFont(new Font("Helvetica", Font.BOLD, 24));
 20:     g.setColor(new Color(255, 215, 0)); // gold color
 21:     g.drawString("Hello From Venus!", 40, 25);
 22:     g.drawImage(getImage(getCodeBase(), "Venus.gif"),
 23:                 20, 60, this);
 24:   }
 25: 
 26: }