Solved

Disable the Window close button on JFrame

Posted on 2003-10-30
4
823 Views
Last Modified: 2012-05-04
How to disable the Window close button (the top right corner x button) on JFrame, I would like to close application from menu.
0
Comment
Question by:ahTri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 50 total points
ID: 9654516
JFrame myFrame = new JFrame("A Frame");

myFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
0
 

Author Comment

by:ahTri
ID: 9654544
Cool, that's partly work now, however the button is not disable, so user still can click it, and they will question "why it's not closed when I click on the button?"
0
 

Author Comment

by:ahTri
ID: 9654581
I got it work out, thanks
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9654587
:-)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question