Determining the Visible Parts of a Displayed Component
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mac_Hale
Posted On:   Tuesday, October 2, 2001 08:45 AM

Given a component that is already displayed, but may be overlapped (e.g., a JInternalFrame), I need to determine all of its visible parts. I assume this would be represented as a set of rectangles (or possibly a shape, though rectangles are sufficient for my application). I've searched for stuff related to clipping regions, but haven't found anything that quite helps. Ideally, there would be a method on JComponent something like: public Rectangle[] getClipRects() or something in a utility class like: public static Rectangle[] getClipRects(JComponent) . I know there is JComponent's getVisibleRect() , but it doesn't do what I'm describing.    More>>

Given a component that is already displayed, but may be overlapped (e.g., a JInternalFrame), I need to determine all of its visible parts. I assume this would be represented as a set of rectangles (or possibly a shape, though rectangles are sufficient for my application). I've searched for stuff related to clipping regions, but haven't found anything that quite helps.

Ideally, there would be a method on JComponent something like:

public Rectangle[] getClipRects()

or something in a utility class like:

public static Rectangle[] getClipRects(JComponent) .

I know there is JComponent's getVisibleRect() , but it doesn't do what I'm describing.

Even Graphics' getClip() method doesn't seem to do it. According to the API documentation, "this method returns the user clip, which is independent of the clipping associated with device bounds and window visibility." So this method won't tell me what is exposed around (or hidden by) overlapping windows.

Any ideas appreciated.

   <<Less
About | Sitemap | Contact