Everything runs perfectly but the String am1 = (String)JOptionPane.showInputDialog has a random default "-1" showing.
private void am1ActionPerformed(java.awt.event.ActionEvent evt) {
getinfo();//Set the random question and answer
am1.setEnabled(false);
Object[] options = {"Answer", "Cancel"};
int n = JOptionPane.showOptionDialog(null,
JeopardyGUI.question1_1,//Reference the question set
"",
JOptionPane.YES_NO_OPTION,
JOptionPane.PLAIN_MESSAGE,
null, //do not use a custom Icon
options, //the titles of buttons
options[0]); //default button title
if(n == JOptionPane.YES_OPTION){
String am1 = (String)JOptionPane.showInputDialog("",JOptionPane.PLAIN_MESSAGE);
if(am1.equalsIgnoreCase(JeopardyGUI.answer1_1)){
Jscore += 100;
JOptionPane.showMessageDialog(null, JeopardyGUI.answer1_1 );
}
else if(!am1.equalsIgnoreCase(JeopardyGUI.answer1_1)){
Jscore += -100;
JOptionPane.showMessageDialog(null, JeopardyGUI.answer1_1 );
}
// else
// am1.setEnabled(true);
}
if(n == JOptionPane.NO_OPTION){
//am1.setVisible(false);
am1.setEnabled(true);
}
}
You are using:
public static String showInputDialog(Object message, Object initialSelectionValue)
JOptionPane.PLAIN_MESSAGE is your initialSelectionValue in this case. It's an int which is equal to -1 I'm guessing. What you actually want is probably:
JOptionPane.showInputDialog("Actual message", "");
Also, be careful:
String am1 = ...
Is hiding am1 the class member which is some Component it seems.
May I also suggest rewriting the handling logic as:
if(am1 != null && am1.equalsIgnoreCase(JeopardyGUI.answer1_1)){
Jscore += 100;
else Jscore += -100;
JOptionPane.showMessageDialog(null, JeopardyGUI.answer1_1 );
You need use the other static method, it don't receive a default value:
JOptionPane.showInputDialog("")
Check JOptionPane API here.
Related
Im developing a small app and I wants to get the total when I click the button total . But if there are null values the code code dosen't work .So additionally following code was added .
int QtyOfChickenBurger;
if ((textField.getText().equals(null))) {
QtyOfChickenBurger = Integer.parseInt(textField.getText())*0;
} else {
QtyOfChickenBurger = Integer.parseInt(textField.getText()) * 70;
}
But still my application don't output the total when the textField is empty. So please help me to fix this.This is the full code.
JButton bttotal = new JButton("Total");
bttotal.setBounds(21, 37, 145, 25);
bttotal.setFont(new Font("Thoma", Font.PLAIN, 12));
bttotal.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg) {
int QtyOfChickenBurger;
if ((textField.getText().equals(null))) {
QtyOfChickenBurger = Integer.parseInt(textField.getText())*0;
} else {
QtyOfChickenBurger = Integer.parseInt(textField.getText()) * 70;
}
int QtyOfChickenBurgerMeal = Integer.parseInt(textField_2.getText()) * 120;
int QtyOfCheeseBurger = Integer.parseInt(textField_3.getText()) * 340;
int QtyOfDrinks = Integer.parseInt(enterQTY.getText());
int spriteCost = Integer.parseInt(enterQTY.getText()) * 55;
int cokaColaCost = Integer.parseInt(enterQTY.getText()) * 60;
int pepsiCost = Integer.parseInt(enterQTY.getText()) * 40;
int lemonJuceCost = Integer.parseInt(enterQTY.getText()) * 35;
int sum = (QtyOfChickenBurger + QtyOfChickenBurgerMeal + QtyOfCheeseBurger);
lblDisplayCostOfMeals.setText(Integer.toString(sum));
String x = String.valueOf(comboBox.getSelectedItem());
if (x == "Sprite") {
lblDisplayCostOfDrinks.setText(Integer.toString(spriteCost));
} else if (x == "Select the drink") {
lblDisplayCostOfDrinks.setText("0");
} else if (x == "Coka Cola") {
lblDisplayCostOfDrinks.setText(Integer.toString(cokaColaCost));
} else if (x == "Pepsi") {
lblDisplayCostOfDrinks.setText(Integer.toString(pepsiCost));
} else if (x == "Lemon juce") {
lblDisplayCostOfDrinks.setText(Integer.toString(lemonJuceCost));
}
}
});
This code is wrong
if ((textField.getText().equals(null))) {
QtyOfChickenBurger = Integer.parseInt(textField.getText())*0;
}
if the textField.getText() is null then you can not parse the null into Integer. In addition, you multiply 0 with a number for what? => just set it to 0.
Change it to
if (textField.getText()==null || textField.getText().equals("")){
QtyOfChickenBurger = 0;
}
I presume you are using Swing JTextField which is a JTextComponent.
getText is returning a String therefore, you will need to check if its null or empty, before parsing it to int later on.
There are few ways of checking it, !textField.getText().isEmpty() and textField.getText() != null
Personally, i would use Commons Lang library StringUtils and just check if the string isBlank(textField.getText())
Additionally you should validate the input, as well You can use the mentioned library and use StringUtils.isNumeric() in your if statement.
First of all textField.getText().equals(null) will never work this only throws a NullPointerException better use textField.getText()==null.
Because the user can enter anything in the TextField you need to validate the input or create a try-catch-block.
The best way would to create a help method to parse the numbers, for example:
public static int readInteger(String text, int defaultValue) {
if(text == null)
return defaultValue;
try {
return Integer.parseInt(text);
} catch (NumberFormatException nfe) {
return defaultValue;
}
}
By the way don't compare Strings with x == "Pepsi" only when you want to check if the String is null.
Read: How do I compare strings in Java?
I am assuming that user can write what he want in that textfield so u should also take care when textfield have a value like 'asd';
String QtyOfChickenBurgerAsString =textField.getText();
Integer QtyOfChickenBurger=null;
try{
QtyOfChickenBurger = Integer.valueOf(QtyOfChickenBurgerAsString);
}catch(Exception ex){
System.out.println(" this is not a number ...do whatever u wanna do");
}
if (QtyOfChickenBurger!=null){
System.out.println("integer value of field text "+QtyOfChickenBurger);
}
I suggest create variables with starting letter in lower case ,and when you compare using equals use the constant first.Also you could find a better solution by using components which accept only numbers in their text.
As of java 9, the Object class has a convenience method for handling null values and it is found in java.util.
public static String processEmployee(String fullName){
// if fullName is null then second argument is returned,otherwise fullName is
String name = Objects.requireNonNullElse(fullName, "empty");
// the processing goes here ...
return name;
}
I have one JFrame where I enter parameters of a matrix, after those parameters being entered, the user is supposed to click a button to start a simulation. The problem is, the button is supposed to be clicked twice instead of once in order to open the JOption pane where a message is written. I just can't figure out why this happens. This is the function that is called from the simulation button's action performed function:
private void setMatrixParameters(){
if(tfTouristNumber.getText().equals("") || tfRowNumber.getText().equals("") || tfColumnNumber.getText().equals("") || tfMinimal.getText().equals("")){
JFrame frame = new JFrame();
JOptionPane.showMessageDialog(frame, "All fields must be filled", "Error!", JOptionPane.ERROR_MESSAGE);
}
//check the matrix dimensions
else if(min + touristNumber > Integer.parseInt(tfRowNumber.getText()) * Integer.parseInt(tfColumnNumber.getText())){
int dimension= min + touristNumber;
JFrame frame = new JFrame();
JOptionPane.showMessageDialog(frame, "Matrix dimensions too small. Need to be at least:" + dimension, "Enlarge matrix!", JOptionPane.ERROR_MESSAGE);
}
else{
this.touristNumber = Integer.parseInt(tfTouristNumber.getText());
int row = Integer.parseInt(tfRowNumber.getText());
int column = Integer.parseInt(tfColumnNumber.getText());
this.matrix = new Object[row][column];
this.min = Integer.parseInt(tfMinimal.getText());
}
}
Your problem in this case is that you are not checking the text field values in the second if-condition. The following should do the trick.
private void setMatrixParameters(){
if(tfTouristNumber.getText().equals("") || tfRowNumber.getText().equals("") || tfColumnNumber.getText().equals("") || tfMinimal.getText().equals("")){
JFrame frame = new JFrame();
JOptionPane.showMessageDialog(frame, "All fields must be filled", "Error!", JOptionPane.ERROR_MESSAGE);
return;
}
// Read values here. (Should probably add a try-catch block around this, in case it can't be parsed as number)
int inTouristNumber = Integer.parseInt(tfTouristNumber.getText());
int inRow = Integer.parseInt(tfRowNumber.getText());
int inColumn = Integer.parseInt(tfColumnNumber.getText());
int inMin = Integer.parseInt(tfMinimal.getText());
//check the matrix dimensions
if(inMin + inTouristNumber > inRow * inColumn){
int dimension= inMin + inTouristNumber;
JFrame frame = new JFrame();
JOptionPane.showMessageDialog(frame, "Matrix dimensions too small. Need to be at least:" + dimension, "Enlarge matrix!", JOptionPane.ERROR_MESSAGE);
}
else{
this.touristNumber = inTouristNumber;
this.matrix = new Object[inRow][inColumn];
this.min = inMin;
}
}
I created a dialog box and have the user enter 5 colors in it from memory. That all completely works, there's just a slight aesthetic problem. Upon entering all 5 colors correctly, or getting one incorrect, it's suppose to wipe the contents within the dialog box and print a message "Sorry! Incorrect color" or "Congratulations". It prints the message, but the JTextField can still be seen somewhat behind the message (A left over portion/clipping).
I've tried using the hide() and remove() methods but they didn't seem to work (Or I'm using them incorrectly), I tried re-making a dialog box upon either but I couldn't seem to solve the issue still. What am I doing wrong/how can I make the JTextField disappear upon completion? Thank you in advance for any help!
Here's the portion where if the user enters a color incorrectly or gets them all correct (txtName is the JTextField):
if(count == 6)//User either finished or entered a color incorrectly
{
//Entered color incorrectly
if(incorrect == true)
{
txtName.setEnabled(false); //Doesn't work
homeScreen.remove(txtName); //Doesn't work
labelName.setText("Incorrect! Sorry - Wrong color.");
//txtName.removeActionListener(new MyButtonListener());
}
else//Correctly finished the game.
{
labelName.setText("Congratulations - your memory skills are perfect!");
//txtName.removeActionListener(new MyButtonListener());
homeScreen.remove(txtName);//Doesn't work
}
}
Here's my entire program (I can't get it format properly in the post):
package memorygame;
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.FlowLayout;
public class MemoryGame
{
private JFrame homeScreen;
private JLabel labelName;
private JTextField txtName;
private JLabel correct;
Vector<String> name = new Vector();
private int count = 1;
private MyButtonListener listen1 = new MyButtonListener();
//Constructor - Method to be called when MemoryGame object called
public void MemoryGame ()
{
homeScreen = new JFrame();
homeScreen.setSize(400,200);
homeScreen.setTitle("Memory Game");
homeScreen.setDefaultCloseOperation(homeScreen.EXIT_ON_CLOSE);
homeScreen.setLayout(new FlowLayout());
labelName = new JLabel();
txtName = new JTextField(10);
createContents();
homeScreen.setVisible(true);
}//End Constructor
//Create components and add them to the window/dialog box
private void createContents()
{
labelName.setText("Enter the color " + count + ":");
System.out.println("The current count is: " + count);
homeScreen.add(labelName);
homeScreen.add(txtName);
txtName.addActionListener(new MyButtonListener());//Allows you to press enter to invoke action
}
//Upon user hitting enter
private class MyButtonListener implements ActionListener
{
public void actionPerformed (ActionEvent e)//When event occurs
{
Scanner in = new Scanner (System.in);//For program input
String answer = "";
//Make memColor an array for randomized colors
/*
Random r = new Random();
String[] memColors = new String[5];
String[] colors = {"red", "green", "blue", "yellow", "brown", "purple"};
for(int i =0; i < memColors.length; i++)
{
memColors[i] = colors[r.nextInt(6)];
}
*/
String memColor1 = "red";
String memColor2 = "black";
String memColor3 = "yellow";
String memColor4 = "green";
String memColor5 = "blue";
boolean incorrect = false;
//If answered incorrectly set count to 5(it'll be 6)
//And have a boolean for if count== 6 for congrats and failure
if(e.getSource() == txtName)
{
answer = txtName.getText();
System.out.println(answer);
}
else
{}
//Check if user entered Correct color, 1= Red, 2= Black, etc.
if(count == 1)
{
if(answer.equalsIgnoreCase(memColor1))
{
txtName.setText("");
}
else
{//Needs to be a custom message box
count = 5;
incorrect = true;
}
}
else if(count == 2)
{
if(answer.equalsIgnoreCase(memColor2))
{
txtName.setText("");
}
else
{
count = 5;
incorrect = true;
}
}
else if(count == 3)
{
if(answer.equalsIgnoreCase(memColor3))
{
txtName.setText("");
}
else
{
count = 5;
incorrect = true;
}
}
else if(count == 4)
{
if(answer.equalsIgnoreCase(memColor4))
{
txtName.setText("");
}
else
{
count = 5;
incorrect = true;
}
}
else if(count == 5)
{
if(answer.equalsIgnoreCase(memColor5))
{
txtName.setText("");
}
else
{
count = 5;
incorrect = true;
}
}
else
{
JOptionPane.showMessageDialog(null, "Something went wrong!");
}
count += 1;
//User has completed the game or entered a color incorrectly
if(count == 6)
{
if(incorrect == true) //Incorrect color
{
txtName.setEnabled(false);
homeScreen.remove(txtName);
labelName.setText("Incorrect! Sorry - Wrong color.");
//txtName.removeActionListener(new MyButtonListener());
}
else //Completed the game correctly
{
labelName.setText("Congratulations - your memory skills are perfect!");
//txtName.removeActionListener(new MyButtonListener());
homeScreen.remove(txtName);
}
}
else
{
labelName.setText("Enter the color " + count + ":");
}
}//End Listener
}//End Button class
public static void main(String[] args) {
//Show message box
//Randomize colors
JOptionPane.showMessageDialog(null, "How good is your memory?\nTry to memorize this color sequence:\n\n red black yellow green blue");
MemoryGame mem = new MemoryGame();
mem.MemoryGame();
}//End Main
}// End Class
Use txtName.setVisible(false); instead of homeScreen.remove(txtName);
Basically, if you want to call remove, you will need to revalidate and repaint container...
You'll also want to ensure that your UI is create within the context of the Event Dispatching Thread, see Initial Threads for more details
Change the code
homeScreen.remove(txtName);
to
homeScreen.remove(txtName);
homeScreen.revalidate();
homeScreen.repaint();
The reason why remove() does not imply revalidate() + repaint() is that remove() is not atomic. The caller might want to perform multiple updates, a sequence of several add() and remove() calls. revalidate() basically "completes" your "UI update transaction", repaint() "pushes it to the screen".
As a side note, your code will be easier to understand and maintain, if you perform a small tiny improvements on variable names. What's homeScreen? And why is it called labelName - what name? And what's txtName - the name of what text? count of what, icecreams?
I suggest the following improvements:
incorrect -> isIncorrect (also change if (incorrect == true) to if (isIncorrect)
homeScreen -> mainFrame or just frame (as you only have one frame)
labelName -> infoLabel or just label (as you only have one label - and remove JLabel correct, it's unused)
txtName -> answerTextField
count -> answerCount
Remove variable listen1, it's not used.
Plus, if you look at the code that does if (count == 1) and the following four if clauses, they are all identical except for the number. A perfect situation for an array. You can convert the variables memColor* to an array String[] memColor. Or maybe that's what the Vector was for. You might instead want to use ArrayList, nobody uses Vector these days in such situations.
So I have a JFrame in Netbeans that holds 20 labels of math equations.
mathLabel1 is "2 + 2"
mathLabel2 is "4 * 4"
etc...
and if mathLabel1 is shown and the user guesses the right answer (4) then I want to setVisible(false) and remove that element from my array, so it doesn't come up as a question again.
Basically, no repeats.
Here is a short version of my code:
//declare variables
String strUserAnswer;
int i;
Random r = new Random();
int randvalue = r.nextInt(19);
JLabel[] math = {mathLabel1, mathLabel2, mathLabel3, mathLabel4, mathLabel5, mathLabel6, mathLabel7, mathLabel8, mathLabel9, mathLabel10,
mathLabel11, mathLabel12, mathLabel13, mathLabel14, mathLabel15, mathLabel16, mathLabel17, mathLabel18, mathLabel19, mathLabel20};
JLabel test;
//method that chooses random math equation
public void random(JLabel test) {
r = new Random();
randvalue = r.nextInt(19);
test = math[randvalue];
if (test == math[0]) {
mathLabel1.setVisible(true);
}
else if (test == math[1]){
mathLabel2.setVisible (true);
}
else if (test == math[2]){
mathLabel3.setVisible (true);
}
else if (test == math[3]){
mathLabel4.setVisible (true);
}
else if (test == math[4]){
mathLabel5.setVisible (true);
}
else if (test == math[5]){
mathLabel6.setVisible (true);
}
else if (test == math[6]){
mathLabel7.setVisible (true);
}
else if (test == math[7]){
mathLabel8.setVisible (true);
}
else if (test == math[8]){
mathLabel9.setVisible (true);
}
else if (test == math[9]){
mathLabel10.setVisible (true);
}
else if (test == math[10]){
mathLabel11.setVisible (true);
}
else if (test == math[11]){
mathLabel12.setVisible (true);
}
else if (test == math[12]){
mathLabel13.setVisible (true);
}
else if (test == math[13]){
mathLabel14.setVisible (true);
}
else if (test == math[14]){
mathLabel15.setVisible (true);
}
else if (test == math[15]){
mathLabel16.setVisible (true);
}
else if (test == math[16]){
mathLabel17.setVisible (true);
}
else if (test == math[17]){
mathLabel18.setVisible (true);
}
else if (test == math[18]){
mathLabel19.setVisible (true);
}
else if (test == math[19]){
mathLabel20.setVisible (true);
}
}
private void guessButtonActionPerformed(java.awt.event.ActionEvent evt) {
// User clicks guess to enter answer, if correct part of puzzle appears
strUserAnswer = answerText.getText();
test = math[randvalue];
//if the math equation chosen is 2+2...
if (test == math[0]) {
//show math equation
mathLabel1.setVisible(true);
//if answer is right...
if (strUserAnswer.equals("4")) {
JOptionPane.showMessageDialog(null, "Yay!! That is right!");
//show puzzle piece, hide equation, and choose a new one
label1.setVisible(true);
mathLabel1.setVisible(false);
//test.remove(math[0]);
test = math[randvalue];
answerText.setText(null);
random(test);
//if answer is wrong...
} else {
JOptionPane.showMessageDialog(null, " Sorry, try again!");
answerText.setRequestFocusEnabled(true);
}
}
and that's repeated for math[1], math[2], math[3], etc...
So how would I do this? I tried the remove() method but that was a shot in the dark...
ok, so this might make your day or break your heart, but you are doing way more than you need to with your random() method. first off, it doesn't seem like you need to take in a parameter
because it looks like you are manually changing the value before you ever use it. also, because each value in the array is in fact a JLabel, you can just say math[randValue].setVisible(true) instead of going through the whole if statement thing. and to solve your problem of removing stuff, there is a quick and dirty way you can do it that i will show you, but you are better off using an ArrayList instead of an Array.
public void random() {
Random r = new Random();
randValue = r.nextInt(math.length); //make sure the index is always within the array
JLabel[] temp = new JLabel[math.length - 1]; //this will do the trick
math[randValue].setVisible(true);
for (int i = 0; i < randvalue; i++) {
temp[i] = math[i]; //fill the new array up to the chosen label
}
for (int i = randValue; i < temp.length; i++) {
temp[i] = math[i + 1]; //fill the rest, omitting the chosen label
}
math = new JLabel[temp.length]; //math is now shorter
math = temp; //put everything back in the original array
}
this should work as a solution using arrays.
hope it helps.
If your data structure will constantly be changing, try using a List instead of an Array:
List<JLabel> labels = new ArrayList<JLabel>();
int numLabels = 20;
for (int i = 0; i < numLabels; i++) {
labels.add(new JLabel(i + " " + i));
}
From there you could always call:
labels.get(4).setVisible(false);
or
labels.remove(4);
And then revalidate your JPanel.
EDIT 2:
I may have misunderstood your question - it seems you want to remove a number and never create a label for it again. This is the correct way to do it:
int numIntegers = 20;
Set<Integer> possibleNumbers = new HashSet<Integer>();
for (int i = 0; i < numIntegers; i++) {
possibleNumbers.add(i);
}
When you want to remove an item, use:
possibleNumbers.remove(14);
Then when you want to present this data, you can use:
panel.clear();
for (Integer number : possibleNumbers) {
panel.add(new JLabel(number + " " + number));
}
(Please note I was incorrect calling JLabels data - they are part of the presentation.)
I had created a JOptionPane of type showInputDialog. When it opens it, it shows me two buttons: OK and Cancel. I would like to handle the action when I push on Cancel button, but I don't know how to reach it. How can I get it?
For example:
int n = JOptionPane.showConfirmDialog(
frame, "Would you like green eggs and ham?",
"An Inane Question",
JOptionPane.YES_NO_OPTION);
if (n == JOptionPane.YES_OPTION) {
} else if (n == JOptionPane.NO_OPTION) {
} else {
}
Alternatively with showOptionDialog:
Object[] options = {"Yes, please", "No way!"};
int n = JOptionPane.showOptionDialog(frame,
"Would you like green eggs and ham?",
"A Silly Question",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[0]);
if (n == JOptionPane.YES_OPTION) {
} else if (n == JOptionPane.NO_OPTION) {
} else {
}
See How to Make Dialogs for more details.
EDIT: showInputDialog
String response = JOptionPane.showInputDialog(owner, "Input:", "");
if ((response != null) && (response.length() > 0)) {
}
This is an old question, and I am an Java newbie so there might be better solutions, but I wanted to know the same, and maybe it can help others, what I did was to check if the response was null.
If the user clicks "cancel", the response will be null. If they click "ok" without entering any text the response will be the empty string.
This worked for me:
//inputdialog
JOptionPane inpOption = new JOptionPane();
//Shows a inputdialog
String strDialogResponse = inpOption.showInputDialog("Enter a number: ");
//if OK is pushed then (if not strDialogResponse is null)
if (strDialogResponse != null){
(Code to do something if the user push OK)
}
//If cancel button is pressed
else{
(Code to do something if the user push Cancel)
}
The showMessageDialog, shouldn't show two buttons, so something is amiss with either your code or your interpretation of it. Regardless, if you want to give the user an choice and want to detect that choice, don't use a showMessageDialog but rather a showConfirmDialog, and get the int returned and test it to see if it is JOptoinPane.OK_OPTION.
You could do it like this:
String val = JOptionPane.showInputDialog("Value: ");
if(val == null){
// nothing goes here if yo don't want any action when canceled, or
// redirect it to a cancel page if needed
}else{
//insert your code if ok pressed
// JOptionPane return an String, as you was talking about int
int value = Integer.ParseInt(val);
}
showInputDialog return NULL if you click cancel and String object even if it's empty.
So all you need to do is test if it's Null and if it's not empty.
package Joptionpane;
import javax.swing.JOptionPane;
public class Cancle_on_JOptionPane {
public static void main(String[] args) {
String s;
int i;
for (i=0;i<100;i++){
s = JOptionPane.showInputDialog(null,"What is your favorite fruit ?");
try {
if (s.equals("")) {
JOptionPane.showMessageDialog(null," Enter your answer !!!"," ^-^ Information^-^ ",JOptionPane.INFORMATION_MESSAGE);
i=2;
} else {
JOptionPane.showMessageDialog(null," s = "+s," ^-^ Information^-^ ",JOptionPane.INFORMATION_MESSAGE);
i=100;
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(null,"Cancle answer !!!"," ^-^ Information^-^ ",JOptionPane.INFORMATION_MESSAGE);
i=100;
}
}
}
}
This may be your answer:
package Joptionpane;
import javax.swing.JOptionPane;
public class Cancle_on_JOptionPane {
public static void main(String[] args) {
String s;
int i;
for(i=0;i<100;i++){
s = JOptionPane.showInputDialog(null,"What is your favorite fruit ?");
try{
if(s.equals("")) {
JOptionPane.showMessageDialog(null," Enter your answer !!!"," ^-^ Information^-^ ",JOptionPane.INFORMATION_MESSAGE);
i=2;
}
else {
JOptionPane.showMessageDialog(null," s = "+s," ^-^ Information^-^ ",JOptionPane.INFORMATION_MESSAGE);
i=100;
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"Cancle answer !!!"," ^-^ Information^-^ ",JOptionPane.INFORMATION_MESSAGE);
i=100;
}
}
}
}