• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

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

Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
What? What, what, what? What what tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic