How to find the active Window in Swing?

Hi all!

I have an RCP plugin (which will be plugged into any RCP app)
and the aim is to get the screenshot of the RCP app. So actually now what i make is, the plugin adds a new menu item to application and whenever the menu item is clicked the pluginForm opens (a form to take and manipulate the screenshots)
But what i want is just to take the capture of the RCP app. So the plugin needs to see the current active Swing windows and get the screen size of that to take just that part of screen.
How can i handle this?

(btw i tried Frame.getOwnerlessWindows(), Frame.getWindows(), Frame.getFrames() methods. they dont give me the 'just rcp app window'. maybe the current running thread is just the plugin form. and it goes invisible during capture, but still there is the rcp app window running in JVM which i want to reach)

Window is java.awt.Window class. how can i extend this and what for?
if i could reach the states of the windows (especially the window of the rcp form) i could also reach the bounds and i wouldnt have problem.

I'm sorry, I thought this was a java programming problem.
By "active window" are you asking at the Java program level or at the OS level.
If the OS level, you need native code.
What is the relationship between the windows you're talking about?

I normally had 2 forms which one of those is the parent of other.
In this RCP plugin stuation, since the plugin must work on all RCP apps, you dont have a parent form. The plugin loads itself. So how to get the parent form (RCP app form which is currently running together with the plugin in JVM)

as i told i have an rcp app.. and plugin also has a form..
so when i want to take the capture, i make the plugin form invisible.. then just the main app is visible, and i put this code.. but it didnot work

It is totally incorrect in that nature because there is no way in Java to convert the long to a reference to a Window class at all. Maybe your code snippet was technically correct but it didn't make it for an answer. You are not helping the forum, nor the OP this way.