Change the OK Cancel string in JOptionPane

后端 未结 3 1652
情深已故
情深已故 2021-01-17 22:55

I was wondering is it possible to change the OK Cancel Button to custom string in java? I have

JOptionPane.showConfirmDialog(message, title, JOptionPane.OK_C         


        
3条回答
  •  盖世英雄少女心
    2021-01-17 23:34

    I know this is very old question. But for future reference, we can do it by add 2 lines before showConfirmDialog:

    UIManager.put("OptionPane.cancelButtonText", "Go back");
    UIManager.put("OptionPane.okButtonText", "Save");
    

提交回复
热议问题