Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a Java Expert!

Join 244,209 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,444 people online right now. Registration is fast and FREE... Join Now!




JOptionPane showConfirmDialog

 
Reply to this topicStart new topic

JOptionPane showConfirmDialog

slimdime
26 Sep, 2008 - 11:01 AM
Post #1

New D.I.C Head
*

Joined: 15 Mar, 2008
Posts: 22

How can I use JOptionPane showConfirmDialog for Left OR Right

CODE

JOptionPane.showConfirmDialog(null,
"Left", "Right", JOptionPane.Left_Right_OPTION);



if Right use

if Left use


How do I set this part up?????

User is offlineProfile CardPM
+Quote Post


William_Wilson
RE: JOptionPane ShowConfirmDialog
26 Sep, 2008 - 11:16 AM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,446



Thanked: 55 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
Here's an example i've used in the past to explain it, joptionpane code should be in a try catch block to handle an exit or -1 value return also.

java

Object[] options = { "Outstanding", "Excellent", "Good", "Fair", "Poor" };
int result = JOptionPane.showOptionDialog(null, "What do you think of " +
"this example ?", "Pick an Option", JOptionPane.DEFAULT_OPTION,
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
System.out.print("So,...,you think the solution is " + options[result] + " ...");

The location of the first null can be replaced by this, if the function calling this code is non-static.

This post has been edited by William_Wilson: 26 Sep, 2008 - 11:17 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 07:50AM

Live Java Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month