473,386 Members | 1,821 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,386 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 3293
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.