The Window Event

The Window Event

View Answers

September 23, 2009 at 10:11 AM

Hi Friend,

Try the following code:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class ButtonEvent extends JFrame {

JButton exit_button = new JButton ("Exit Button");

ButtonEvent () {
exit_button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt) {
int i = JOptionPane.showConfirmDialog(null,"Do you want to exit from JFrame?\n" + "Click any button for further processing.");
switch(i) {
case JOptionPane.YES_OPTION:
System.exit(0);
break;
case JOptionPane.NO_OPTION:
break;
case JOptionPane.CANCEL_OPTION:
break;
}
}
});
add(exit_button);
setVisible(true);
setSize(100, 50);
setTitle("Window Button");
}
public static void main (String [] args) {
ButtonEvent obj = new ButtonEvent();
}
}

Thanks









Related Tutorials/Questions & Answers:
The Window Event - Swing AWT
The Window Event  hey plz i need help here... plz modify..., 700); setTitle("The Window Button"); setVisible(true... void actionPerformed(ActionEvent event) { } public static void
Java window state event
Java window state event  Two java windows, one on top of another... Window at the back is deactivated when the other is on the top. Can iconify when there is only one window using win+d key. In windows, press win+d, window
Advertisements
How to stop window closing in "internalFrameClosing" event.
How to stop window closing in "internalFrameClosing" event.  In an internal frame listener in the internalFrameClosing event I want to ask the user... it but it is still there. Is there a way to abort the frame closing event so the user can go back
Window
Window  how to create an window of a person like regestration form
window in center
window in center  if i run the programme thw window is in lie in top left corner i want a window open in center
Window Blind
Window Blind  Custom built . Over 30 years of shutter experience. Free in-home consultations
The scroll browser event of jQuery
The scroll browser event of jQuery In this tutorial ,we will print message on browser's window scrolling using scroll browser event of jQuery...().appendTo(document.body); $(window).scroll(function () { $("span"
Chat window
the chat window pops up.. It is a div in the chat homepage.. There are few other... in the same application. I want to know how to retain the chat window (along..., the chat window should be constant across all pages in the application for current
Multi window
contains all the details. when i submit this page, a new window opens and asks to enter password. if password entered is correct, the flow goes to previous window
window closing
window closing  hello, In my project i have login,logout and some jsp pages are there and each jsp page is using javascript and onunload script. and i need one solution that,when ever user trying to close browser window
Window Script
Window Script  i want to write windows script can you help me in writing those i want to write script so that it follows below steps Step 1) downloading file from FTP 2) Unzip it 3) Edit it 4) zip it 5) upload again to FTP
active window means
active window means  active window means what?   The active window is the term used to describe the window that is currently being used
Passing values from child window to parent window.
Passing values from child window to parent window.  Hai, I'm having a requirement ,in that when i open a (pop-up)child window from a parent window,the child window will contain multiple checkboxes and when i select multiple
making help window
making help window   how to make help window in gui with java
pop up window in java
pop up window in java  How to open a pop up window in Java
ModuleNotFoundError: No module named 'window'
ModuleNotFoundError: No module named 'window'  Hi, My Python... 'window' How to remove the ModuleNotFoundError: No module named 'window'... to install padas library. You can install window python with following command
Passing values from child window to parent window.
Passing values from child window to parent window.  http://www.roseindia.net/java/pass-value-example/pass-value-child-to-parent.shtml I have gone thru the link but my requirement is checkboxes.can u please explain
Window Container in Flex4
Window Container in Flex4 : This container are use window applications in flex 4. Spark Window container is provide a way if user want to create own window. The Window container are provide layout and content of operating system window
KEY EVENT HANDLING
KEY EVENT HANDLING  I am trying to write a program that receives every key stroke even when the window is not active or it's minimized. Is there anyway to do
Prototype Window Class
Prototype Window Class       This javascript class allows you to add window in a HTML page... if you include effects.js file , but it's not mandatory. Prototype Window
Pop Up window - WebSevices
Pop Up window  How refresh pop up window,Tell me correct code for this problem.  Hi friend, I am sending a link. This link will help you. Visit for more information. http://www.roseindia.net/jsp/popup-window
Window State - Swing AWT
Window State  Thanks for you reply. I have already tried the setSize() method of AWT Window and also with JFrame. But I want to Maximize the Window when it is opened by the user and instead of the Maximize
Relative positioning of the child window on top based on the movement of parent window
Relative positioning of the child window on top based on the movement of parent window  Relative positioning of the child window on top based on the movement of parent window
opening new window - Java Beginners
window.i.e., I want to know, how a new window(B) can be opened by clicking a button on the first(parent)window.The show() method does open a new window but the parent window is not disabled when the child(new) window is showing.The show() method
child window - Development process
child window  I want to create new small window on my website using java script. But i couldn't hide the status bar in small window. How to do this one ? Kindly help me.   Hi Friend, Please visit the following
window addsubview remove in iPhone
window addsubview remove in iPhone  Hi, How to add a splash screen or some other view and then remove it and add new view. I want program... can use following code:ADS_TO_REPLACE_2 [window addSubview:tabBarController.view
Closing the browser window
Closing the browser window  <BODY> <form> <input type=button value="Close Window" onClick="javascript:window.close();"> <...; thought that this will close the window of the browser but not working
swings window header
swings window header  i have a string1 it contains 3 parts,for example "123456 service hello" and string2 contains "change request " like... for this program . i want to apply this to window header part. Thanks
Sliding window protocol
Sliding window protocol  Hello Everyone. Will anybody send me the code to make sliding window protocol animation using java swings. I have to do project with all types sliding protocols such as selectiverepeat,gobackN..etc. I
To put a "close window" link on a page?
To put a "close window" link on a page?  To put a "close window" link on a page
JSP Window. Open
JSP Window. Open          JSP Window. Open  is used to open a new window in JSP. The JavaScript function  window.open( ) open a new browser
reload parent window - WebSevices
reload parent window  Hi, Here I have a code for close child window and reload parent window. window.opener.location.href="http://www.mysite.net/example.php"; self.close(); Its working properly when User enters
How to Make iPhone Window Application
How to Make iPhone Window Application  Hi, For Making iphone window application, what parameters i have to follow or provide example related to iphone window application. Thanks
JavaScript Open Modal Window
JavaScript Open Modal Window...; In this section, you will learn how to open Modal window in JavaScript. As we have already discussed about the window.open() method of Window object which
event handling
event handling  diff btwn event handling in ASP.net and in HTML
ModuleNotFoundError: No module named 'moderngl-window'
ModuleNotFoundError: No module named 'moderngl-window'  Hi, My... named 'moderngl-window' How to remove the ModuleNotFoundError: No module named 'moderngl-window' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'moderngl-window'
ModuleNotFoundError: No module named 'moderngl-window'  Hi, My... named 'moderngl-window' How to remove the ModuleNotFoundError: No module named 'moderngl-window' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'rolling-window'
ModuleNotFoundError: No module named 'rolling-window'  Hi, My... named 'rolling-window' How to remove the ModuleNotFoundError: No module named 'rolling-window' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sliding_window'
ModuleNotFoundError: No module named 'sliding_window'  Hi, My... named 'sliding_window' How to remove the ModuleNotFoundError: No module named 'sliding_window' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'time-window'
ModuleNotFoundError: No module named 'time-window'  Hi, My Python... 'time-window' How to remove the ModuleNotFoundError: No module named 'time-window' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'waffle-window'
ModuleNotFoundError: No module named 'waffle-window'  Hi, My... 'waffle-window' How to remove the ModuleNotFoundError: No module named 'waffle-window' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'window-slider'
ModuleNotFoundError: No module named 'window-slider'  Hi, My... 'window-slider' How to remove the ModuleNotFoundError: No module named 'window-slider' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'window-terminal'
ModuleNotFoundError: No module named 'window-terminal'  Hi, My... named 'window-terminal' How to remove the ModuleNotFoundError: No module named 'window-terminal' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'window-tracker-x11'
ModuleNotFoundError: No module named 'window-tracker-x11'  Hi, My... named 'window-tracker-x11' How to remove the ModuleNotFoundError: No module named 'window-tracker-x11' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'window-slider'
ModuleNotFoundError: No module named 'window-slider'  Hi, My... 'window-slider' How to remove the ModuleNotFoundError: No module named 'window-slider' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'window-terminal'
ModuleNotFoundError: No module named 'window-terminal'  Hi, My... named 'window-terminal' How to remove the ModuleNotFoundError: No module named 'window-terminal' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'window-tracker-x11'
ModuleNotFoundError: No module named 'window-tracker-x11'  Hi, My... named 'window-tracker-x11' How to remove the ModuleNotFoundError: No module named 'window-tracker-x11' error? Thanks   Hi, In your
POP UP WINDOW
POP UP WINDOW  Dear Sir, Can you please help in providing the methos for opening up a pop up window just after selecting an option from a drop...',then a pop up window should open with name,designation and roll number.Please help me
Pop-up Window
Pop-up Window  Hi......... please tell me How do I pass parameters to a pop-up window? Thanks  For example: code for pop-up window: <?xml version="1.0"?> <s:TitleWindow xmlns:fx="http
Event Listeners
Event Listeners  I want to learn the Event Listeners in Java. Any... is the good tutorial and example of Event Listeners in Java. Please check the tutorial Java - Event Listeners Example in Java Applet. Thanks

Ads