[2740] in java-interest
Re: JDK clipping bug(s)
daemon@ATHENA.MIT.EDU (julie melbin)
Thu Oct 12 10:08:24 1995
Date: Thu, 12 Oct 95 08:06:46 EDT
To: flar@bendenweyr.Eng.Sun.COM (Jim Graham), java-interest@java.Eng.Sun.COM
From: julie melbin <julie@world.std.com>
At 07:20 PM 10/11/95 -0700, Jim Graham wrote:
>You can no longer clear the clipping rectangle. That way applets can't
>paint outside their bounds. If you want multiple clipping rectangles
>within your applet, then use the Graphics.create(x, y, w, h) method to
>create a "sub-Graphics" object...
>
>What you want to do is to take the graphics that was handed in and do:
>
> public void paint(Graphics g) {
> Graphics ng = g.create(10, 10, 30, 30);
> ng.drawSomething();
> ng.dispose();
> ng = g.create(50, 50, 30, 30);
> ng.drawSomethingElse();
> ng.dispose();
> }
BTW I had to do this (before receiving your mail) to keep an object from
rendering outside the applet (panel) bounds. Was it because I had a panel
inside the applet and it can leak? (FRect is one of our things, and the
interesection code as well. Back before JDK and it's intersection code....)
Rectangle r = bounds();
FRect winRect = new FRect(r.x, r.y, r.width, r.height);
FRect iRect = winRect.intersectingRect(cx, cy, cw, ch);
if (iRect != null)
{
getGraphics().clipRect(iRect.x, iRect.y, iRect.width,
iRect.height);
}
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com