[5218] in java-interest
RE: AWT differences between platforms
daemon@ATHENA.MIT.EDU (Avner Aviad)
Fri Feb 2 07:02:55 1996
From: Avner Aviad <aaviad@netvision.net.il>
To: "'java-interest@java.sun.com'" <java-interest@java.sun.com>
Date: Fri, 2 Feb 1996 12:17:43 +-200
Mike wrote:
> For the first time I tried to bring up an app I usually run
> on Solaris under WinNT. The result was an exception:
> "AWT-Callback-Win32" java.lang.InternalError
> getGraphics implemented only for Canvas components
> I do indeed do getGraphics on non-component stuff, namely images.
> Am I not supposed to do this, and the Solaris implementation just
> lets me get away with it, or is it a bug in the WinNT version, or
> is this something that will be there eventually?
> While I'm at it...is anyone aware of other differences between
> platforms?
> -Mike
> P.S. I'm running the "production" version 1 on both platforms.
The difference you are reporting is actually a difference between the =
Beta version and the "shipping" SDK 1.0.=20
I have no idea if this is intended or a bug but note that this exception =
will happen even if you do not call getGraphics() directly but by way of =
calling repaint() on (say) a TextField force the ScreenUpdater to send =
an update(Graphics g) to this Component which in turn requires a =
getGraphics() call.
This is one of the unfortunate design errors that AWT seem to have. =
There is a complete imbalance in the implementation of native =
components. The programmer that attempts to subclass any of the non =
Canvas components will find out that the Win32 implementation will paint =
it's own controls without calling back into the Java code. This will =
prevent any special effects or changes to the painting of these =
controls.
Note that the same observation can be made to the handling of mouse =
events. One would have expected the AWT to consult a derived object =
mouse handling "override" before doing their own thing, but instead the =
AWT native object will handle most mouse events without any notification =
to the derived class.
Example:=20
One would like to have:
class MyField extends TextField {
...
public void paint(Graphics g) {
super.paint(g);
doMyOwnPainting(g);
}
public boolean mouseDown(Event e, int x, iny y) {
if(doMyOwnThing)
{
handleMyOwnMouseDown(x, y);
return true;
}
else
return super.mouseDown(e, x, y);
}
}
now, if this was a Canvas all of this works. In my opinion this is a =
very odd and unacceptable way to implement AWT.
Hope you got it.=20
What do you think ???
--------------------------------------------------
Avner Aviad - Webra Software =20
EMail: aaviad@netvision.net.il
Web: http://www.netvision.net.il/php/aaviad
--------------------------------------------------=20
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com