Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFrame decorations aren't working

 
Jeremy Tartaglia
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeremy Tartaglia
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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. ^^
 
Jeremy Tartaglia
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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. ^^
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 -
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic