[3677] in java-interest
Awt.Component, paint and update in Beta1
daemon@ATHENA.MIT.EDU (michel meyer)
Wed Nov 22 04:36:15 1995
Date: Sat, 18 Nov 1995 17:07:33 -0100
To: java-interest@java.sun.com
From: michel@mmania.com (michel meyer)
Hi folks,
I'm having a little problem with the paint and update method of an
awt.Component: the basic idea is that I want an "invisible" component.=20
No, this is not as stupid as it may seem, I just want to take advantage of
the mouseEnter, mouseDown, ... methods without having any noticeable object
on screen.
So I thought that it should be easy to derive a testCanvas class from
awt.Canvas, and overide paint and update as empty methods.
However, it appears that "some other objects ..." are still erazing the
testCanvas' position with the backgroundColor of the testCanvas object.
In the src/java/awt/Component.java file, there's a comment next to the
update method which says: "you can assume that the background has not been
erazed" ... It does not seem to be right...
Here's some sample code:
// the testCanvas class
import java.awt.*;
class testCanvas extends Canvas {
testCanvas () {
setBackground(Color.pink);
resize(50,50);
}
public void paint(Graphics g) {
}
public void update(Graphics g) {
}
}
// the testApplet class
import java.applet.Applet;
import testCanvas;
public class testApplet extends Applet {
public void init() {
add(new testCanvas());
}
=20
}
// a test html files
<HEAD>
<TITLE> Test Applet</TITLE>
</HEAD>
<BODY>
<br>
<APPLET CODE=3D"testApplet.class" WIDTH=3D200 HEIGHT=3D100>
</APPLET>
</BODY>
Does anybody have an idea of who is drawing that #=A4#%=B5! pink square !!!
Any help would be welcome !!!
thanks for your time
Michel (michel@mmania.com)
##############################
# MultiMania Production #
# 1.rue de Paradis #
# 75010 Paris #
# Tel: 45-23-08-19 #
# E-mail: info@mmania.com #
##############################
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com