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



Home Answers Viewqa Swing-AWT how to use JOptionPane.YES_NO_OPTION
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Priyanjan
how to use JOptionPane.YES_NO_OPTION
2 Answer(s)      2 years and 8 months ago
Posted in : Swing AWT


As i said earliar i am making HRMS , the last phase is logout button. when logout button is clicked , an option dialog should appear which ask for yes or no .

PROBLEM is i dont know how to use JOptionPane.YESNOOPTION so that i can give user choice of yes or no before logging out finally..

i also thinking how to use the input (yes or no ) given by the user. Rest i know if i am ab to use the input given by the user.

Please help as soon as possible.

Thanks in advance


Advertisement
View Answers

April 15, 2012 at 2:44 PM


Hi,

You will have to use following code:

int i=JOptionPane.showConfirmDialog(null, "Really want to quit?","Really",JOptionPane.YES<em>NO</em>OPTION);
  // TODO add your handling code here:
if(i==JOptionPane.YES_OPTION)
{
    //CODE WHICH WILL BE CALLED ONCE YES IS PRESSED
}
else
{
    //CODE WHICH WILL BE CALLED ONCE NO IS PRESSED
}


April 15, 2012 at 2:47 PM


You have to store the value of Joption pane in an integer which can be done from following: int i=JOptionPane.showConfirmDialog(null, "Really want to quit?","Really",JOptionPane.YESNOOPTION);

then use if (With int i) to find the answer:

if(i==JOptionPane.YES_OPTION) {

} else {

}



Related Tutorials/Questions & Answers:
how to use JOptionPane.YES_NO_OPTION
how to use JOptionPane.YES_NO_OPTION  As i said earliar i am making HRMS , the last phase is logout button. when logout button is clicked , an option... logging out finally.. i also thinking how to use the input (yes or no ) given
How to use Servlet and Ajax?
How to use Servlet and Ajax?  How to use Servlet and Ajax
Advertisements
how to use calender in php
how to use calender in php  how to put calender in php
How to use AT Commands with J2ME?
How to use AT Commands with J2ME?  How to use AT Commands with J2ME? Thank you for your answer
how to use mouse pressed
how to use mouse pressed   to action mouse clicked
how to use button in array
how to use button in array  plz tell me how to code for button in array
How to Use Collections
How to Use Collections  how to use ArrayList and HashMaps in case of user defined class  Hi Friend, Please visit the following links: http://www.roseindia.net/java/jdk6/ http://www.roseindia.net/javacodeexamples
How to use dojoscript with jsf?
How to use dojoscript with jsf?  Hi all , am new to jsf. can anyone help me out in using dojo script frame work with jsf. how to integrate dojo into jsf. Thanks in advance
how to use setAttribute
how to use setAttribute  how to get following codes using setAttributes in java??? Employee xlink:type="extended" xlink:show="new" xlink:actuate="onRequest
how to use an editable combobox
how to use an editable combobox   Hello Everyone!!!!!!!! I have a jcombo box with certain values and i want to use it as an editable that means when user will type something in combobox, according to that text only matching item
how to use jstl tags?
how to use jstl tags?  I installed jstl jar in my libraries. I got the following error in console screen. I need the solution to resolve this uri in web.xml. please help me.......... "The absolute cannot be resolved
How to use bytes
How to use bytes  I have saved my project and uploaded the picture. But when i want to view the picture, there was no picture. I used the method...(rs.getBytes("employeephoto")); How to get the correct answer to view the picture by using
How to use Apache POI?
How to use Apache POI?  Can anyone tell me how to use Apache POI??I went through http://poi.apache.org/ but cannot understand anything.I don't know how to implement.Please help me out.   Download zip file from
How to use between in mysql.
How to use between in mysql.  I want to display records inbetween two dates and also want to use where condition( like and deptname='Pediatry Department').      Syntax: SELECT column_name(s) FROM table_name
how to use dirivers - JDBC
how to use dirivers  i try connecting to a database with this code but i get this ClassNotFoundException, already i have added the path to the connector to my classpath variable. here is the code; import java.sql.Connection
how to use - EJB
how to use  I am buiding a Shopping cart and i want to fetch image and its product id from the database(MySql) and fetching of image should be done by JPA
How to use Hibernate get sessionfactory?
How to use Hibernate get sessionfactory?  Hi, How to use hibernate get sessionfactory? Thanks
how to use image tag in jsp
how to use image tag in jsp  How to use image tag in JSP
how to use marathi font in swing?
how to use marathi font in swing?  I want to use marathi language on labels,buttons
How to use session in struts 1.3
How to use session in struts 1.3  i want to know how to use session in Struts specially in logIn authentication
how to use group by in nested query
how to use group by in nested query  Hai, How to use group by clause in nested query select statement in subquery i am having where clause.please help me.thanks in advance
How to use the PHP filetype() Function
How to use the PHP filetype() Function  Hi, What is the use of filetype() Function in php programming. Can anyone give any online example of the PHP filetype() Function. Thanks
How to use this keyword in java
How to use "this" keyword in java   ... use this keyword. Here, this section provides you an example with the complete code of the program for the illustration of how to what is this keyword and how
how to use a placeholders - JSP-Servlet
how to use a placeholders  dear sir, how to use and declare a place holder in java? i have to send the following mail Dear [Column 1... be fetch ,so how to use a place holder for this [column ] and also how to get
How to use Date Picker iPhone
How to use Date Picker iPhone  Hi, I am beginner in mobile Application platform. I want to develop a small application in iphone platform to Show current date and display alert view message. So, how to define the date picker
How to use Map in velocity
How to use Map in velocity       This Example shows you how to use map in velocity. The method used in this example are described below:-   1:- Initialize
How to use List in velocity
How to use List in velocity       This Example shows you how to use List in velocity. The method used in this example are described below:-  1:- Initialize
How to use Associations and Joins in Hibernate?
How to use Associations and Joins in Hibernate?  Hi. I am trying to find the examples of Associations and Joins in Hibernate. Give me the code and examples of Associations and Joins in Hibernate. Thanks   Hi, Please
How to use charAt() method in Java?
How to use charAt() method in Java?  Hi, what is the correct way of using chatAt() method in Java? Thanks   The charAt() method in Java is used to find the specific character at specific index. Check the tutorial
How to use Jquery in jsp page
How to use Jquery in jsp page  Hello Sir, I am developing a web application in which i have to show database table values into Gridview.... 3.Edit 4.Delete. plz sir Guide me how to complete the above task. Thank you
How to use Java Beans in JSP?
How to use Java Beans in JSP?  Hi, I have developed a employee bean in Java: public class Employee{ private String name; private String code; ..... } Please tell me how I can use Employee Java bean in JSP page? Thanks
 

 

 

DMCA.com