• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JFrame decorations aren't working  RSS feed

 
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?
 
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. ^^
 
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 -
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!