• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trouble with Jframe.setUndecoratble  RSS feed

 
Devasia Manuel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every time I set a JFrame to undecoratble to remove the title bar, I get an excpetion saying that the JFrame cannot be diplayable. Can anyone help me to solve this problem??

Thanks
Dev

P.S. I am using the Netbean's IDE Jframe form to create my JFrame
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which LAF are you using?
Can you please provide the stack trace?
Don't forget to use the CODE tags
 
Rob Spoor
Sheriff
Posts: 20898
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the frame already visible? setUndecorated is not allowed after calling pack() or setVisible(true).

You could use a workaround:

By calling dispose(), the frame is no longer displayable, and the call to setUndecorated will succeed.
 
Devasia Manuel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see, let me try that...
 
Devasia Manuel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys, it worked, I just needed to call dispose on the JFrame then set it to setVisible(true)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!