I have a few questions regarding JOptionPane
class. Why does the JOptionPane
custom buttons quit by default? For example, if i click on clear, why does the program close and not clear the textfield and stay still? Also, if i click on add or retrieve data to/from file, why does the program closes? Why don't they react like JButtons
on a frame?
Could you please show me an example of how to clear or go to previous form without the window closing down.
Code:
String[] buttons = new String[] {"Add", "Clear", "Previous Window", "Retrieve"};
int example = JOptionPane.showOptionDialog(mypanel, mypanel, "Choose",
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE,
null, buttons , buttons [0]);`