JOptionPane showInputDialog with custom buttons

后端 未结 3 2044
野趣味
野趣味 2020-12-21 19:08

Can i use showInputDialog with my custom buttons or can i rename \"OK\" and \"Cancel\" button on showInputDialog.

3条回答
  •  再見小時候
    2020-12-21 20:02

    Check out the JOptionPane documentation.


    You can send an array of objects that define the buttons:

    Show a warning dialog with the options OK, CANCEL, title 'Warning', and message 'Click OK to continue':

    Object[] options = { "OK", "CANCEL" };
    JOptionPane.showOptionDialog(null, "Click OK to continue", "Warning",
    JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
    null, options, options[0]);
    

提交回复
热议问题