This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JDialog X Button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JDialog X Button" Watch "JDialog X Button" New topic
Author

JDialog X Button

Karen Baog
Ranch Hand

Joined: Mar 02, 2005
Posts: 120
Hi all,

How do I get rid of the X button on the top right corner of a JDialog box?

Thanks to all.


amerzil co-ed student<br />"Praise be the Code"
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You can't. You can disable it though. setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); That way, when the user hits the X, nothing will happen.


GenRocket - Experts at Building Test Data
Karen Baog
Ranch Hand

Joined: Mar 02, 2005
Posts: 120
Hi guys,

How do I catch the event when the User clicks on the X button ?

Cheers!
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
You need to register a WindowListener, as far as I remember.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Scott Delap
author
Ranch Hand

Joined: Apr 05, 2005
Posts: 73
You might check this out:

Customizing Window Adornments
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDialog X Button
 
Similar Threads
JDialog
Disabling the 'X' button of JDialog
JOptionPane behavior
JDialog
Getting a null frame (Event dispatching problem?)