This is a utility class to help lay out frames on a desktop in an organized
fashion. It's based on a technique for packing small lightmaps into a single
larger texture; read about it here:
Basically, we carve up the available screen real estate into smaller and
smaller rectangles as we add frames. These rectangles are organized in a
tree where each node contains a rectangle representing a portion of the
screen and also has a reference to the frame occupying that rectangle (or
null if the space is unoccupied). A null reference signals that that piece
of the screen is unoccupied.
This implementation is event based to avoid issues arising from frames not
knowing their final size immediately upon construction - they have to build
and pack any child components first, which often doesn't happen before the
frame's constructor returns.
In its current form it has several limitations: it doesn't respond to screen
resizing or merge rectangles as frames are closed. It's also limited to only
handling ProbeFrames, when it could conceivably be made more generic to
handle more generic InternalFrames. Lastly, it's possible that this should
have been implemented as a LayoutManager to be applied to a component. This
was quickest though.
User: gonzatob
Date: 2/8/12
Time: 2:51 PM
This is a utility class to help lay out frames on a desktop in an organized fashion. It's based on a technique for packing small lightmaps into a single larger texture; read about it here:
http://www.blackpawn.com/texts/lightmaps/default.html
Basically, we carve up the available screen real estate into smaller and smaller rectangles as we add frames. These rectangles are organized in a tree where each node contains a rectangle representing a portion of the screen and also has a reference to the frame occupying that rectangle (or null if the space is unoccupied). A null reference signals that that piece of the screen is unoccupied.
This implementation is event based to avoid issues arising from frames not knowing their final size immediately upon construction - they have to build and pack any child components first, which often doesn't happen before the frame's constructor returns.
In its current form it has several limitations: it doesn't respond to screen resizing or merge rectangles as frames are closed. It's also limited to only handling ProbeFrames, when it could conceivably be made more generic to handle more generic InternalFrames. Lastly, it's possible that this should have been implemented as a LayoutManager to be applied to a component. This was quickest though.