0

Ok, enough playing guys, today I'm gonna challenge you big:

So I have an option dialog and want to change the icon of the dialog on the right side so instead of showing a default red cross it will show me a question icon. Is there a basic library in Java that might return me an Icon object for the JOptionPane constructor?

Thanks!!

JOptionPane option=new JOptionPane();
option.showOptionDialog(mainFrame, "Choose shape type", null, 0, 0, null, new String [] {"Lines only","Bounded shapes"}, null);
Max Segal
  • 1,955
  • 1
  • 24
  • 53
  • 1
    Note that `showOptionDialog` is a static method - no need to create an instance of JOptionPane and [access in a non-static manner](http://stackoverflow.com/questions/5642834/why-should-the-static-field-be-accessed-in-a-static-way) – copeg May 27 '15 at 20:10

1 Answers1

2

Why you don't use something like this: there is icon option JOptionPane.QUESTION_MESSAGE

JOptionPane option=new JOptionPane();
option.showOptionDialog(mainFrame, "Choose shape type", null, 0, JOptionPane.QUESTION_MESSAGE, null, new String [] {"Lines only","Bounded shapes"}, null);
Krzysztof Cichocki
  • 6,294
  • 1
  • 16
  • 32