473,432 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

how can i modify the close operation for a GUI JFrame?

hello,

i currently have a driver program which connects my application to a local database. I was wondering how i can monitor the default close operation such that when the user presses the X in the top-right, i can catch that action even and do something with it like System.out.println("you have chosen to exit the program"); or print a message to a file or something.

Any suggestions?
Dec 8 '10 #1
1 3296
Dheeraj Joshi
1,123 Expert 1GB
Try overriding addWindowListener() method of WindowAdapter.

WindowAdapter is in java.awt.event package.

Regards
Dheeraj Joshi
Dec 16 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Lem | last post by:
How do I close a JFrame Window, other than calling system.exit(0) or dispatchEvent()? Thanks in advance, Lem
1
by: Jules Winfield | last post by:
My WinForms application can have any number of top level forms open at a given time. If the user selects File|Exit, all of the forms are closed. The loop to close the forms looks something like this:...
11
by: Pablo Salazar | last post by:
Hi people!!. Which is diference between to use method CLOSE and DISPOSE to close a form? Tx. Pablo Salazar
3
by: Sameh Ahmed | last post by:
Hello there IS there a way to cancel a form close after the user clicks on the close button? I want to confirm from the user the close operation and if he chooses not to, I would cancel the...
0
by: rbharath | last post by:
hi, I have developed a multithreaded MFC activeX control, which i host on the Internet Explorer. when i click on the close button of the Internet Explorer i.e., when the user decides to end the...
3
by: bharath.0523 | last post by:
hi, I have developed a multithreaded MFC activeX control, which i host on the Internet Explorer. when i click on the close button of the Internet Explorer i.e., when the user decides to end the...
2
by: Nageshwarrao | last post by:
Hi All, I have a window.open() popup.In which I placed an "Close" button.when I Click on that "Close" button it will pass some information to the Database and after that the window will...
1
by: pankajs | last post by:
Hi! I m facing a problem that I want to close one JFrame when two are running simultaneously.. How can it be done??????
3
by: pankajs | last post by:
Hi ! I want to know that how I can close one JFrame without exiting the program when two or more JFrame are being used ??????
3
by: =?Utf-8?B?RGF2ZVA=?= | last post by:
I've got a situation in a VB 2003 Windows application with an MDI form and a child form. In certain situations, when the child is closed by the user, I also want to close the MDI parent. Is there...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.