Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Disable the Window close button on JFrame

Posted on 2003-10-30
4
Medium Priority
?
838 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
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

879 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