Mega Code Archive

 
Categories / Java Tutorial / Swing
 

The JOptionPane Options and Initial Value Arguments

a Component, place the component in the button area. an Icon, place the Icon within a JButton and place the button in the button area. an Object, convert it to a String and place the String in a JButton, and place the button in the button area. To have no buttons on the option pane, pass an empty array as the options setting: new Object[] { }. If you want to have both an icon and a text label on the button, you can manually create a JButton and place it in the array.