applet paint? not sure why this doesn't work...

From: Evan Dekker (ehendrikd_at_yahoo.com)
Date: 04/22/04


Date: 22 Apr 2004 06:43:36 -0700

hi all

im not why this code doesn't work:
/////////

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

public class TestApplet extends Applet {
  public void init() {
    setLayout(new GridLayout(5, 1));
    
    add(new Label("hello this is label"));
    add(new TextField());
    add(new Button("a button to press"));
    add(new TextArea());
    add(new Checkbox("a checkbox to check"));
  }
  
  public void paint(Graphics poGraphics) {
    super.paint(poGraphics);
    
    System.out.println("here");
    
    Color oForegroundColor = poGraphics.getColor();
    poGraphics.setColor(getBackground());
    poGraphics.fill3DRect(20, 20, 100, 100, true);
    poGraphics.setColor(oForegroundColor);
  }
}

////////

what i am trying to achieve is a option pane like popup in the applet
(yes, no, ok, etc) that draws on top of the current components.

i have tried overidding update, paintAll, paintComponents, nothing
draws on top of the current components.

i am writting for 1.1 but using 1.4, dont know if that is relevant.

thanks in adavance
evan


Quantcast