Home Answers Viewqa Swing-AWT The Window Event

 
 


Naman
The Window Event
1 Answer(s)      3 years and 8 months ago
Posted in : Swing AWT

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 Pages:
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
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
JFrame - Window
the window. w.setVisible(true); Makes the window visible, and starts the Event... Java: JFrame - Window Description The javax.swing.JFrame class is used to create a "window". This window has a few characteristics of its own (title
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
Window
Window  how to create an window of a person like regestration form
First Window
Java NotesExample - First Window This is about the simplest GUI (Graphical User Interface) window that you can make. The window is very small... 17 //--- basic_windows/FirstWindow.java - Creates a very small window
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
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"
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
Flex terminating event flow example
Flex terminating event flow example       In the example below, how to terminate an event flow is demonstrated. With this example the motive of previous event phase detecting
Closing any kind of browser window without confirmation using javascript
Closing any kind of browser window without confirmation using javascript  Here is my requirement, I have to close a browser window on onload event. I have tried with window.close() and self.close(). But it doesn't work. Please
closing the internet explorer window of any version without confirmation using javascript
closing the internet explorer window of any version without confirmation using javascript  Hi all, Here is my requirement, I have to close microsoft internet explorer window on onload event without confirmation. It should
Flex Add Event Listener example
in flex components. Here in the example only mouse event is added... are added, an alert pop up window comes with some messages coded on it. Event listeners are the methods or functions in which events are added
SWT "Enter" key event - Swing AWT
the enter key event? My requirement is , I want some SWT button action... listener = new Listener() { public void handleEvent(Event e... on the blank window"); shell.open(); while (!shell.isDisposed
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
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
event handling
event handling  diff btwn event handling in ASP.net and in HTML
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
Flex event
Flex event  Hi.... please tell me about How does Flex event system works? Thanks  Ans: When event are triggered there are three...: In the capturing phase, Flex examines an event target?s ancestors in the display list to see
Event in flex
Event in flex  Hi..... can you tell me about that How do you make component participate in event mechanism? Thanks   Ans: Extend EventDispatcher or any subclass of it or implement IEventDispatcher
Event management
Event management   Hi, I want event management application like maintaining email notifications while task creation and update in broader way using spring java
Event in flex
Event in flex  Hi..... I want to know about What does calling preventDefault() on an event do? How is this enforced? please give me an example for that Thanks   Ans: The methods of the Event class can be used
Flex event
Flex event  Hi... please give me the answer with example What is event Bubbling? Thanks in advance  Event Bubbling: In the bubbling phase, Flex examines an event?s ancestors for event listeners. Flex starts
Flex event
Flex event  hi...... How to capture and event if the component is disabled? please give an example..... Thanks in advance
Flex event
Flex event  Hi.... Please tell me about How to create your own event in flex? Thanks
Click event
Click event  hi............ how to put a click event on a particular image, so that it can allow to open another form or allow to display result in tabular form????????/ can u tell me how to do that????????/ using java swings
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
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
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
Event helpers
Event helpers       Event helpers As we all know events are actions or occurrences detected by a program. And event handlers are methods which handles
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
Java event handling
Java event handling  What event results from the clicking of a button
How to Handle Event Handlers?
How to Handle Event Handlers?  How to Handle Event Handlers
handling Button Event in iphone
handling Button Event in iphone  handling Button Event in iphone
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
Java event-listener
Java event-listener  What is the relationship between an event-listener interface and an event-adapter class
Java event delegation model
Java event delegation model  What is the highest-level event class of the event-delegation model
Example - Tiny Window
Java NotesExample - Tiny Window The example discussed here is used to create tiny window in swing. The TinyWindow.java - Creates a very small window...; and the window can be resized.   You can download the code given here and try on your
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
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... code: [window addSubview:tabBarController.view]; To remove
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.