🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18580

Re: graphics drawing on components

#18580
From: John P. McGrath
Date: Mon, 25 May 1998 00:00
64 lines
3128 bytes
Tad Frysinger <tfrysinger@earthlink.net> wrote in article
<MPG.fc61db3b2f180989801@forums.borland.com>...

> I am interested if anyone knows of a way to draw graphics primitives on a

> container (heavyweight or lightweight) that contains heavyweight 
> components, such that those primitives appear on top of those contained 
> components.

Nope.  That will not work.  To do that sort of thing, you need to be using
lightweight components.

To understand the interactions between heavyweight and lightweight
components, first picture a system with only heavyweight components.  These
components are mapped directly to operating system components.  A good
model would be to cut out a piece of paper for each component.  Arrange the
pieces of paper just like you would arrange the components in the software
version.  The only difference is that a child component is cropped by its
parent, so you will have to imagine that with the paper model (or fold back
the edge of the piece of paper).

Now add lightweight components.  These do not get a separate piece of
paper.  Instead, they are drawn on the nearest heavyweight component
following up the component hierarchy.  So if you have a heavyweight
component A, and in it put a heavyweight component B and a lightweight
component C, you have only two heavyweight components, or two pieces of
paper, A and B.  B is within (on top of) A.  C is drawn on the surface of
A, so it will always be under B, even if it is added above B.

So if you want to draw something and make it appear on top of B, you will
have to draw on B.  If you try to add another heavyweight component on top
of B, you can do that, but all heavyweight components are rectangular and
they are opaque.  So the result will obscure the contents of B.

I hope this helps.

-- 
John P. McGrath
<mcgrath@enter.net>
<jpm@nscs.fast.net>

> 
> From my review, it appears that rendering 
> myPanel.getGraphics().drawRect() (for example) always has the rectangle 
> appearing *behind* heavyweight components.  Does anyone have a way to do 
> this where the rectangle obscures a heavyweight component?
> 
> I've got what I need working with lightweight components, but for various

> reasons I really need to work with heavyweight components instead.
> 
> Actually, I suppose I don't need to use graphics primitives - what I need

> is the ability to draw/erase rectangles very quickly, without disturbing 
> what lies underneath them.  Using setXORmode with the graphics methods 
> for drawing seemed the best way to accomplish this, but I'm open to other

> suggestions.
> 
> Thanks,
> 
> Tad
> 
Technical Details
Message-ID: <01bd87bd$902403d0$0e47aacc@ferd>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <MPG.fc61db3b2f180989801@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,4fab21b1cd472fd7
X-Google-Attributes: gidf74b3,public
From: "John P. McGrath" <mcgrath@enter.net>
Subject: Re: graphics drawing on components
Date: 1998/05/25
Message-ID: <01bd87bd$902403d0$0e47aacc@ferd>
X-Deja-AN: 356275376
References: <MPG.fc61db3b2f180989801@forums.borland.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language