Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Removing close button from JFrame, JDialog  RSS feed

 
Thomas Mcfarrow
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

How could I remove the "X" button from a JDialog. I don't care about disabling it with DO_NOTHING_ON_CLOSE. I would like it removed completely.


Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this works OK on 1.4.0_01 (no X),
but does nothing on 1.5.0_05 (X remains)

add these 2 lines to the constructor
setUndecorated(true);
getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
 
Thomas Mcfarrow
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Michael... I already tried your suggestion but only on 1.5.x. Unfortunately, using 1.4.x isn't an option.

I am unfamilar with the Look and Feel how could I customize the button using the L&F?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!