/** * Gets the localized string from resource bundle. Subclass can override it to provide its own string. Available * keys are defined in buttons.properties that begin with "Button.". * * @param key the resource string key * * @return the localized string. */ public String getResourceString(String key) { return ButtonResources.getResourceBundle(getLocale()).getString(key); }
/** * Gets the string representing Yes button. * * @param locale the locale * @return the string. * @since 3.3.8 */ public static String getYesString(Locale locale) { String text = UIDefaultsLookup.getString("OptionPane.yesButtonText", locale); if (text == null || text.length() <= 0) { text = ButtonResources.getResourceBundle(locale).getString("Button.yes"); } return text; }
/** * Gets the string representing No button. * * @param locale the locale * @return the string. * @since 3.3.8 */ public static String getNoString(Locale locale) { String text = UIDefaultsLookup.getString("OptionPane.noButtonText", locale); if (text == null || text.length() <= 0) { text = ButtonResources.getResourceBundle(locale).getString("Button.no"); } return text; }
/** * Gets the string representing Cancel button. * * @param locale the locale * @return the string. * @since 3.3.8 */ public static String getCancelString(Locale locale) { String text = UIDefaultsLookup.getString("OptionPane.cancelButtonText", locale); if (text == null || text.length() <= 0) { text = UIDefaultsLookup.getString("ColorChooser.cancelText"); if (text == null || text.length() <= 0) { text = ButtonResources.getResourceBundle(locale).getString("Button.cancel"); } } return text; }
/** * Gets the string representing OK button. * * @param locale the locale * @return the string. * @since 3.3.8 */ public static String getOKString(Locale locale) { String text = UIDefaultsLookup.getString("OptionPane.okButtonText", locale); if (text == null || text.length() <= 0) { text = UIDefaultsLookup.getString("ColorChooser.okText"); if (text == null || text.length() <= 0) { text = ButtonResources.getResourceBundle(locale).getString("Button.ok"); } } return text; }
private void toggleDetailsArea() { final ResourceBundle resourceBundle = ButtonResources.getResourceBundle(optionPane.getLocale()); if (_detailsArea.isVisible()) { setDetailsVisible(false); _detailsArea.setVisible(false); _detailsButton.setText(optionPane instanceof JideOptionPane ? ((JideOptionPane) optionPane).getResourceString("Button.showDetails") : resourceBundle.getString("Button.showDetails")); _detailsButton.setMnemonic(optionPane instanceof JideOptionPane ? ((JideOptionPane) optionPane).getResourceString("Button.showDetails.mnemonic").charAt(0) : resourceBundle.getString("Button.showDetails.mnemonic").charAt(0)); } else { setDetailsVisible(true); _detailsArea.setVisible(true); _detailsButton.setText(optionPane instanceof JideOptionPane ? ((JideOptionPane) optionPane).getResourceString("Button.hideDetails") : resourceBundle.getString("Button.hideDetails")); _detailsButton.setMnemonic(optionPane instanceof JideOptionPane ? ((JideOptionPane) optionPane).getResourceString("Button.hideDetails.mnemonic").charAt(0) : resourceBundle.getString("Button.hideDetails.mnemonic").charAt(0)); } }
protected Object[] addDetailsButton(Object[] options, boolean showDetails) { if (showDetails) { Object[] newOptions = new Object[options.length + 1]; System.arraycopy(options, 0, newOptions, 0, options.length); final ResourceBundle resourceBundle = ButtonResources.getResourceBundle(optionPane.getLocale()); if (isDetailsVisible()) { newOptions[newOptions.length - 1] = new ButtonFactory( ButtonNames.DETAILS, optionPane instanceof JideOptionPane ? ((JideOptionPane) optionPane).getResourceString("Button.hideDetails") : resourceBundle.getString("Button.hideDetails"), optionPane instanceof JideOptionPane ? ((JideOptionPane) optionPane).getResourceString("Button.hideDetails.mnemonic").charAt(0) : resourceBundle.getString("Button.hideDetails.mnemonic").charAt(0), null); } else { newOptions[newOptions.length - 1] = new ButtonFactory( ButtonNames.DETAILS, optionPane instanceof JideOptionPane ? ((JideOptionPane) optionPane).getResourceString("Button.showDetails") : resourceBundle.getString("Button.showDetails"), optionPane instanceof JideOptionPane ? ((JideOptionPane) optionPane).getResourceString("Button.showDetails.mnemonic").charAt(0) : resourceBundle.getString("Button.showDetails.mnemonic").charAt(0), null); } return newOptions; } else { return options; } }
_applyButton.setAction(new AbstractAction(ButtonResources.getResourceBundle(Locale.getDefault()).getString("Button.apply")) { private static final long serialVersionUID = 3413994234663396927L; _applyButton.setMnemonic(ButtonResources.getResourceBundle(Locale.getDefault()).getString("Button.apply.mnemonic").charAt(0)); _applyButton.setEnabled(false);
_applyButton.setAction(new AbstractAction(ButtonResources.getResourceBundle(Locale.getDefault()).getString("Button.apply")) { private static final long serialVersionUID = -7553895212164069062L; _applyButton.setMnemonic(ButtonResources.getResourceBundle(Locale.getDefault()).getString("Button.apply.mnemonic").charAt(0)); _applyButton.setEnabled(false);
final ResourceBundle resourceBundle = ButtonResources.getResourceBundle(optionPane.getLocale()); defaultOptions[0] = new ButtonFactory( ButtonNames.CLOSE,