I am aware of possibility to have an array of objects (usually Strings) as the parameter options, so we can have buttons with custom labels.
Is there any easier way to just for example change the value of OK_OPTION option button label/text from "ok" to "okAy" ?
Thanks in advance
I'm really tired of being engaged with stuff other than Java and programming
Maneesh Godbole wrote:Whats wrong with the existing way of changing the button text?
I am talking about JOptionPane !
please consider this :
i want to see whether is there any way not to use options and have just one option same OK_OPTION but with different text than "ok" !
I checked the documentations, there is no such methods something like setOK_OPTIONvalue(String customLabel), i also checked the source code of JOptionPane to find where this value is made, but didn't find (i wanted to subclass JOptionPane and change the value of default optionType(s) such as OK_OPTION or OK_CANCEL_OPTION designate)
You can use UIManager to override these values. For instance:
You can set the value for "OptionPane.okButtonText" for the OK button. But be warned, this will affect all option panes, not just the current one. I would just use showOptionPane with that one button, possibly wrapped in a static utility method: