File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes How do I get layered items to show outside the parent frame? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How do I get layered items to show outside the parent frame?" Watch "How do I get layered items to show outside the parent frame?" New topic
Author

How do I get layered items to show outside the parent frame?

Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140
Ok, I don't know if what I'm asking is possible, and I haven't worked with layered items and such before now.

However, here's the code I've got thus far:


Now, obviously the two JPanels are larger than their container, so the extra size doesn't show.

What I'd like is to have the entire blue and green boxes showing. I don't know if I can do this with the components I'm using or not. I also realize that it means they'll be "on top of" the border that they're supposed to be contained in.

Is there any way to accomplish what I want? Ultimately, I plan to remove the comment from the setOpaque statement, and I do need to maintain the functionality whereby I can click on the area where the third button is concealed, and yet still have it triggered. Plus, I'm looking to capture mouse events in the area of those JPanels that would (if what I want to do works) be outside the frame).

Thanks in advance!



EDIT: I should probably just explain what I'm trying to do. I've got an application that has a GUI display, and takes up part of the screen. I want to put some sort of invisible layer (akin to a glass pane) above it, but that is the size of the entire screen rather than just the size of the GUI of my application, such that I can use said invisible layer to track mouse events that would otherwise be outside of my GUI and on the OS/Desktop.
[ October 26, 2005: Message edited by: Joe Vahabzadeh ]
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
No, you can't have lightweight components outside of the heavyweight they're contained in. I don't know whether or not what you're trying to do is impossible, but I do know it's impossible to do it that way. The JFrame would have to take up the entire screen.
[ October 26, 2005: Message edited by: Ken Blair ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I get layered items to show outside the parent frame?