about appletviewer

alice dubois alice.dubois at lemel.fr
Wed Nov 18 06:49:55 PST 1998


Hi,

To use the appletviewer my file.java must call the method resize(). Else the
 frame is very small and nothing appears if I try to resize it. 

Is it normal ? Or does it miss something else in the file.java ?

Here is my file hello.java:

import java.awt.*;
import java.applet.*;

/*	Write Hello World with a little graphics! */

public class hello extends Applet {
  // define a font variable global in the applet
  private Font font;


  // Initialize Applet once 
  public void init() {
    resize(450,250);
    font=new Font("TimesRoman",Font.BOLD+Font.ITALIC,48);
  
  }

  // write HELLO WORLD inside a yellow 3D rectangle
  public void paint(Graphics g) {
    
    g.setColor(Color.yellow);
    g.fill3DRect(10,10,420,100,true);
    g.setColor(Color.black);
    g.setFont(font);
    g.drawString("HELLO WORLD",40,75);
  
  }
}

Thanks

Alice


More information about the kaffe mailing list