Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT The Window Event
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Naman
The Window Event
1 Answer(s)      5 years and a month ago
Posted in : Swing AWT



Advertisement
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
Window
Window  how to create an window of a person like regestration form
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"
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
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
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 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
event handling
event handling  diff btwn event handling in ASP.net and in HTML
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
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
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..... 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
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..... 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 tell me about How to create your own event in flex? Thanks
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 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
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
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
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
pop up window in java
pop up window in java  How to open a pop up window in Java
making help window
making help window   how to make help window in gui with java
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
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
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
 

 

 

DMCA.com