File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 15286
    
    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 - A Test Data Generation Platform
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
JOptionPane behavior
JDialog
JDialog
Disabling the 'X' button of JDialog
Getting a null frame (Event dispatching problem?)