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 ]
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 ]