File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JOptionPane.showConfirmDialog -- i need help!

 
Em Aiy
Ranch Hand
Posts: 226
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i am displaying a confirm dialog box like



it displays a dialog box, with "YES" option selected. What i want is to make the default selection of "NO" option. How can i?
 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mport javax.swing.*;

public class Tester {
public static void main(String[] args) {
JButton yesButton = new JButton("Yes");
JButton noButton = new JButton("No");
Object buttonArray[] = {yesButton,noButton};
JOptionPane.showOptionDialog(null,"Hai","Hai",JOptionPane.YES_NO_OPTION,JOptionPane.PLAIN_MESSAGE,new ImageIcon("test.jpg"),buttonArray,buttonArray[1]);
}
}

Hope this helps for you!
dinesh.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Muhammad Ali", we don't have too many rules around here but we do have a Naming Policy. Please adjust your display name accordingly.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic