Snapping Floating Windows GUI

If you've used Winamp before, you've noticed how it's comprised of a few independent frames or "windows" that snap together to align with each other and the sides of the screen. The program I'm developing hopes to use a similar GUI.

Firstly, how can you make multiple windows that can talk to each other? Is this as simple as using many JFrames that are all in scope of one another?

Secondly, how can the frames "snap" in place as a Winamp one would?

And lastly, somehow when a frame is either directly or vicariously snapped to the main Winamp frame, moving the main one brings all "children" frames with it. This seems a bit sophisticated, but if you go for the floating and snapping window package, you might as well upgrade to the dependent motion special as well, ya know. How can it all be done?

[833 byte] By [tk393a] at [2007-11-27 6:05:38]
# 1

That can all be accomplished in Java (aside from the cool

non-rectangular "skins" unfortunately). Just like a Layout Manager

lays out components in a JPanel you need to write a simple

Frame Layout Manager (not a real class) to manage several

JFrames (or JWindows).

In this "Frame Layout Manager", if 2 windows are satisfactorily close

then consider them "snapped". Move the window that is currently

being dragged into a snapped position.

When any window moves move the list of windows which are

considered "snapped" to it.

See? Very easy. A lot of things like this just require some boring

typing - theres no "trick" to them.

This is just clever use of getLocation and setLocation.

TuringPesta at 2007-7-12 16:52:01 > top of Java-index,Java Essentials,Java Programming...