SlideShare a Scribd company logo
1 of 2
Download to read offline
import javax.swing.JOptionPane;
publicclass GUI_DropDownList {
publicstaticvoid main(String[] args) {
int answer=0;
int x=JOptionPane.showConfirmDialog(null,"Do you want to continue...", "OPTION",
JOptionPane.YES_NO_OPTION);
if (x==0) {
answer=dialogAskingTheUserToSelectAString();
if (answer != 0)
JOptionPane.showMessageDialog(null, "Message " + answer);
else
JOptionPane.showMessageDialog(null, "You have cancelled the operation",
"ALERT",JOptionPane.ERROR_MESSAGE);
}
else
JOptionPane.showMessageDialog(null, "Bye...",
"ALERT",JOptionPane.ERROR_MESSAGE);
}
staticint dialogAskingTheUserToSelectAString() {
Object[] possibleValues = {"Message 1","Message 2","Message 3","Message 4"};
Object selectedValue = JOptionPane.showInputDialog(null,"Choose one",
"Input",JOptionPane.INFORMATION_MESSAGE, null,possibleValues, possibleValues[0]);
int result=0;
if (selectedValue=="Message 1")
result = 1;
elseif (selectedValue=="Message 2")
result = 2;
elseif (selectedValue=="Message 3")
result = 3;
elseif (selectedValue=="Message 4")
result = 4;
return result;
}
}
After you have successfully run the program, modify it, and add more operations to perform such
as the following mathematical operation.
Note: The user should select the operation to perform from the 4 mathematical operations

More Related Content

Similar to import javax.swing.JOptionPane;publicclass GUI_DropDownList {.pdf

Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldBTI360
 
Hi,I have modified the Point.java file as per your requirement.P.pdf
Hi,I have modified the Point.java file as per your requirement.P.pdfHi,I have modified the Point.java file as per your requirement.P.pdf
Hi,I have modified the Point.java file as per your requirement.P.pdfanokhijew
 
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdfObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdfrajkumarm401
 

Similar to import javax.swing.JOptionPane;publicclass GUI_DropDownList {.pdf (6)

Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 World
 
Property-based testing
Property-based testingProperty-based testing
Property-based testing
 
Poly-paradigm Java
Poly-paradigm JavaPoly-paradigm Java
Poly-paradigm Java
 
662305 10
662305 10662305 10
662305 10
 
Hi,I have modified the Point.java file as per your requirement.P.pdf
Hi,I have modified the Point.java file as per your requirement.P.pdfHi,I have modified the Point.java file as per your requirement.P.pdf
Hi,I have modified the Point.java file as per your requirement.P.pdf
 
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdfObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
 

More from fantoosh1

Identify the step in the innovation process at which the following a.pdf
Identify the step in the innovation process at which the following a.pdfIdentify the step in the innovation process at which the following a.pdf
Identify the step in the innovation process at which the following a.pdffantoosh1
 
If the demand for a product is given by the equation Qd = 100 .pdf
If the demand for a product is given by the equation Qd = 100 .pdfIf the demand for a product is given by the equation Qd = 100 .pdf
If the demand for a product is given by the equation Qd = 100 .pdffantoosh1
 
If the assets of a business are 260000 and the liabilities are 190000 .pdf
If the assets of a business are 260000 and the liabilities are 190000 .pdfIf the assets of a business are 260000 and the liabilities are 190000 .pdf
If the assets of a business are 260000 and the liabilities are 190000 .pdffantoosh1
 
Identify and analyze the factors that influence the level of trust p.pdf
Identify and analyze the factors that influence the level of trust p.pdfIdentify and analyze the factors that influence the level of trust p.pdf
Identify and analyze the factors that influence the level of trust p.pdffantoosh1
 
Identify a true statement about the theory of Symbolic Interactionis.pdf
Identify a true statement about the theory of Symbolic Interactionis.pdfIdentify a true statement about the theory of Symbolic Interactionis.pdf
Identify a true statement about the theory of Symbolic Interactionis.pdffantoosh1
 
Identification of the issue healthcare to all Impact of the issue at a.pdf
Identification of the issue healthcare to all Impact of the issue at a.pdfIdentification of the issue healthcare to all Impact of the issue at a.pdf
Identification of the issue healthcare to all Impact of the issue at a.pdffantoosh1
 
I suggest that the Chocolate Bliss Company expands to somewhere in E.pdf
I suggest that the Chocolate Bliss Company expands to somewhere in E.pdfI suggest that the Chocolate Bliss Company expands to somewhere in E.pdf
I suggest that the Chocolate Bliss Company expands to somewhere in E.pdffantoosh1
 
i want to create an app on powerapps that has 4 buttons as follows o.pdf
i want to create an app on powerapps that has 4 buttons as follows o.pdfi want to create an app on powerapps that has 4 buttons as follows o.pdf
i want to create an app on powerapps that has 4 buttons as follows o.pdffantoosh1
 
I need some help with creating a login page for android studio. This.pdf
I need some help with creating a login page for android studio. This.pdfI need some help with creating a login page for android studio. This.pdf
I need some help with creating a login page for android studio. This.pdffantoosh1
 
I need help with this code working Create another project and add yo.pdf
I need help with this code working Create another project and add yo.pdfI need help with this code working Create another project and add yo.pdf
I need help with this code working Create another project and add yo.pdffantoosh1
 
I need help with the code pattern Flowers.cpp - This program r.pdf
I need help with the code pattern   Flowers.cpp - This program r.pdfI need help with the code pattern   Flowers.cpp - This program r.pdf
I need help with the code pattern Flowers.cpp - This program r.pdffantoosh1
 
I need help with responding to two people in my week one class discu.pdf
I need help with responding to two people in my week one class discu.pdfI need help with responding to two people in my week one class discu.pdf
I need help with responding to two people in my week one class discu.pdffantoosh1
 
I need help understanding how this equation highlight in blue comes .pdf
I need help understanding how this equation highlight in blue comes .pdfI need help understanding how this equation highlight in blue comes .pdf
I need help understanding how this equation highlight in blue comes .pdffantoosh1
 
I have an assignment which is called Technology project where I will.pdf
I have an assignment which is called Technology project where I will.pdfI have an assignment which is called Technology project where I will.pdf
I have an assignment which is called Technology project where I will.pdffantoosh1
 
I am not able to complete the last function. Could anyone please hel.pdf
I am not able to complete the last function. Could anyone please hel.pdfI am not able to complete the last function. Could anyone please hel.pdf
I am not able to complete the last function. Could anyone please hel.pdffantoosh1
 
In Edit Mode, connect the Start Shape to the Decision Shape.Test t.pdf
In Edit Mode, connect the Start Shape to the Decision Shape.Test t.pdfIn Edit Mode, connect the Start Shape to the Decision Shape.Test t.pdf
In Edit Mode, connect the Start Shape to the Decision Shape.Test t.pdffantoosh1
 
In Edit Mode, reposition the shapes in the True route to match the a.pdf
In Edit Mode, reposition the shapes in the True route to match the a.pdfIn Edit Mode, reposition the shapes in the True route to match the a.pdf
In Edit Mode, reposition the shapes in the True route to match the a.pdffantoosh1
 
In early December, Alice and Bob decided to open the Sample Cafe with .pdf
In early December, Alice and Bob decided to open the Sample Cafe with .pdfIn early December, Alice and Bob decided to open the Sample Cafe with .pdf
In early December, Alice and Bob decided to open the Sample Cafe with .pdffantoosh1
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdffantoosh1
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdffantoosh1
 

More from fantoosh1 (20)

Identify the step in the innovation process at which the following a.pdf
Identify the step in the innovation process at which the following a.pdfIdentify the step in the innovation process at which the following a.pdf
Identify the step in the innovation process at which the following a.pdf
 
If the demand for a product is given by the equation Qd = 100 .pdf
If the demand for a product is given by the equation Qd = 100 .pdfIf the demand for a product is given by the equation Qd = 100 .pdf
If the demand for a product is given by the equation Qd = 100 .pdf
 
If the assets of a business are 260000 and the liabilities are 190000 .pdf
If the assets of a business are 260000 and the liabilities are 190000 .pdfIf the assets of a business are 260000 and the liabilities are 190000 .pdf
If the assets of a business are 260000 and the liabilities are 190000 .pdf
 
Identify and analyze the factors that influence the level of trust p.pdf
Identify and analyze the factors that influence the level of trust p.pdfIdentify and analyze the factors that influence the level of trust p.pdf
Identify and analyze the factors that influence the level of trust p.pdf
 
Identify a true statement about the theory of Symbolic Interactionis.pdf
Identify a true statement about the theory of Symbolic Interactionis.pdfIdentify a true statement about the theory of Symbolic Interactionis.pdf
Identify a true statement about the theory of Symbolic Interactionis.pdf
 
Identification of the issue healthcare to all Impact of the issue at a.pdf
Identification of the issue healthcare to all Impact of the issue at a.pdfIdentification of the issue healthcare to all Impact of the issue at a.pdf
Identification of the issue healthcare to all Impact of the issue at a.pdf
 
I suggest that the Chocolate Bliss Company expands to somewhere in E.pdf
I suggest that the Chocolate Bliss Company expands to somewhere in E.pdfI suggest that the Chocolate Bliss Company expands to somewhere in E.pdf
I suggest that the Chocolate Bliss Company expands to somewhere in E.pdf
 
i want to create an app on powerapps that has 4 buttons as follows o.pdf
i want to create an app on powerapps that has 4 buttons as follows o.pdfi want to create an app on powerapps that has 4 buttons as follows o.pdf
i want to create an app on powerapps that has 4 buttons as follows o.pdf
 
I need some help with creating a login page for android studio. This.pdf
I need some help with creating a login page for android studio. This.pdfI need some help with creating a login page for android studio. This.pdf
I need some help with creating a login page for android studio. This.pdf
 
I need help with this code working Create another project and add yo.pdf
I need help with this code working Create another project and add yo.pdfI need help with this code working Create another project and add yo.pdf
I need help with this code working Create another project and add yo.pdf
 
I need help with the code pattern Flowers.cpp - This program r.pdf
I need help with the code pattern   Flowers.cpp - This program r.pdfI need help with the code pattern   Flowers.cpp - This program r.pdf
I need help with the code pattern Flowers.cpp - This program r.pdf
 
I need help with responding to two people in my week one class discu.pdf
I need help with responding to two people in my week one class discu.pdfI need help with responding to two people in my week one class discu.pdf
I need help with responding to two people in my week one class discu.pdf
 
I need help understanding how this equation highlight in blue comes .pdf
I need help understanding how this equation highlight in blue comes .pdfI need help understanding how this equation highlight in blue comes .pdf
I need help understanding how this equation highlight in blue comes .pdf
 
I have an assignment which is called Technology project where I will.pdf
I have an assignment which is called Technology project where I will.pdfI have an assignment which is called Technology project where I will.pdf
I have an assignment which is called Technology project where I will.pdf
 
I am not able to complete the last function. Could anyone please hel.pdf
I am not able to complete the last function. Could anyone please hel.pdfI am not able to complete the last function. Could anyone please hel.pdf
I am not able to complete the last function. Could anyone please hel.pdf
 
In Edit Mode, connect the Start Shape to the Decision Shape.Test t.pdf
In Edit Mode, connect the Start Shape to the Decision Shape.Test t.pdfIn Edit Mode, connect the Start Shape to the Decision Shape.Test t.pdf
In Edit Mode, connect the Start Shape to the Decision Shape.Test t.pdf
 
In Edit Mode, reposition the shapes in the True route to match the a.pdf
In Edit Mode, reposition the shapes in the True route to match the a.pdfIn Edit Mode, reposition the shapes in the True route to match the a.pdf
In Edit Mode, reposition the shapes in the True route to match the a.pdf
 
In early December, Alice and Bob decided to open the Sample Cafe with .pdf
In early December, Alice and Bob decided to open the Sample Cafe with .pdfIn early December, Alice and Bob decided to open the Sample Cafe with .pdf
In early December, Alice and Bob decided to open the Sample Cafe with .pdf
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdf
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdf
 

Recently uploaded

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 

Recently uploaded (20)

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

import javax.swing.JOptionPane;publicclass GUI_DropDownList {.pdf

  • 1. import javax.swing.JOptionPane; publicclass GUI_DropDownList { publicstaticvoid main(String[] args) { int answer=0; int x=JOptionPane.showConfirmDialog(null,"Do you want to continue...", "OPTION", JOptionPane.YES_NO_OPTION); if (x==0) { answer=dialogAskingTheUserToSelectAString(); if (answer != 0) JOptionPane.showMessageDialog(null, "Message " + answer); else JOptionPane.showMessageDialog(null, "You have cancelled the operation", "ALERT",JOptionPane.ERROR_MESSAGE); } else JOptionPane.showMessageDialog(null, "Bye...", "ALERT",JOptionPane.ERROR_MESSAGE); } staticint dialogAskingTheUserToSelectAString() { Object[] possibleValues = {"Message 1","Message 2","Message 3","Message 4"}; Object selectedValue = JOptionPane.showInputDialog(null,"Choose one",
  • 2. "Input",JOptionPane.INFORMATION_MESSAGE, null,possibleValues, possibleValues[0]); int result=0; if (selectedValue=="Message 1") result = 1; elseif (selectedValue=="Message 2") result = 2; elseif (selectedValue=="Message 3") result = 3; elseif (selectedValue=="Message 4") result = 4; return result; } } After you have successfully run the program, modify it, and add more operations to perform such as the following mathematical operation. Note: The user should select the operation to perform from the 4 mathematical operations