javaswingjinternalframe

Java Swing arranging JInternalFrames


Is there any default functionality for arranging JInternalFrames in Java Swing?

I would like to have the Cascade, Tile, etc... functionality within my Java Swing application like this: http://www.codeproject.com/KB/cs/mdiformstutorial.aspx I could only find code where they did the arranging manually. Is there no support for this in Java Swing or am I a bit blind?


Solution

  • I've done cascade before but I did it by shifting the frames pixels to create the affect I do not know another way of doing this, I would work out how big the JDesktopPane is then get an array of you internal frames with getAllFrames(), then perform the sizing and shifting manually.

    I am certain (allthough I haven't looked for at least 2 years now) that swing has no other way to perform these operations, I'm sure someone somewhere has a written a third party library to bolt onto swing apps, if not I'd write one and open source it :)

    Edit,

    Just thought the other way you could do tile etc, would be to write a custom layout manager that did the heavy lifting work for you something like FrameTileLayoutManager, then use that.. its just a thought.