List of usage examples for javax.swing.text InternationalFormatter getFormat
public Format getFormat()
From source file:org.revager.tools.GUITools.java
/** * Formats the given spinner./*ww w . ja v a 2 s. co m*/ * * @param sp * the spinner */ public static void formatSpinner(JSpinner sp, boolean hideBorder) { JSpinner.DefaultEditor defEditor = (JSpinner.DefaultEditor) sp.getEditor(); JFormattedTextField ftf = defEditor.getTextField(); ftf.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT); InternationalFormatter intFormatter = (InternationalFormatter) ftf.getFormatter(); DecimalFormat decimalFormat = (DecimalFormat) intFormatter.getFormat(); decimalFormat.applyPattern("00"); DecimalFormatSymbols geSymbols = new DecimalFormatSymbols(Data.getInstance().getLocale()); decimalFormat.setDecimalFormatSymbols(geSymbols); if (hideBorder) { sp.setBorder(null); } }