I'm trying to switch between UIs at run time. I switch the Look and Feel, and tell the system to update but for some (Windows, Motif, and a few downloaded UIs) the window decorations refuse to come up. Obviously, they don't have decorations, so is there a way to dynamically switch between the decorations in a UI and the decorations specified by the operating system?
I'm not sure if L&F applies to JFrames since they are actual operating system objects (complete with HANDLEs if you're familiar with good ol' Win32 API programming). Child elements such as JPanels, and JButtons and who knows what else shouldn't have any problems reflecting your changes.
Well, it must apply somehow, because Metal L&F will change the window decorations on a JFrame. A few others which I downloaded from Javootoo.com do the same: Compiere, Kunststoff, Metouia, Plastic, Plastic3D, and Tonic. But, all I can imagine is going on is that, when the JFrame gets the signal from the UIManager, it just performs a simple check and, if there aren't Window Decorations available, just skips over drawing them. I really don't want that, because then I lose the close box, the ability to minimize and maximize the window, and it just looks wrong. ^^
Joined: Mar 11, 2004
Heh, well, I found -A- way to do it. Just make a new JFrame with the specifications you need, copy all the components over, and delete the current window. Messy, but it works. ^^
You can also call setUndecorated( false ) to return the native frame border to the frame. You also have to check and make sure the look and feel support by using the getSupportsWindowDecorations() method of the LookAndFeel class. Here's how I got it to work -
Write once, run anywhere, because there's nowhere to hide! - /. A.C.