File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OverlayLayout?

 
Laird Nelson
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any pointers on how to use OverlayLayout? I'd like to overlay a button on a label in the bottom right corner, but no matter what I do with alignmentX and alignmentY on either component, I can't get my panel--which has its layout set to a new OverlayLayout--to do anything even REMOTELY predictable.
Does anyone know how to work with this awful, undocumented class?
Thanks,
Laird
 
kyle amburn
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What OverlayLayout does is layout each component on top of the another component. It does not allow you to specify the precise positioning within the component. What I have done to use this class is extend it and override the layoutContainer method with the following code:

This uses the location specified by a components setLocation() methods top place the component absolutely in the x,y coordinates of the component with this layout. Just remember that when you use this layout, the first added component will appear on top.
Kyle
 
Laird Nelson
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kyle amburn:
What OverlayLayout does is layout each component on top of the another component. It does not allow you to specify the precise positioning within the component. What I have done to use this class is extend it and override the layoutContainer method with the following code:

This uses the location specified by a components setLocation() methods top place the component absolutely in the x,y coordinates of the component with this layout. Just remember that when you use this layout, the first added component will appear on top.
Kyle

OK; but various references I've stumbled across say that the components will be laid out with their "alignment points on top of each other" (see O'Reilly's Nutshell book, for example). So I would think that just using setAlignmentX and setAlignmentY that I could achieve *relative*, not absolute, positioning. But this doesn't seem to be the case at all. Any ideas?
Laird
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic