本文整理匯總了Java中javax.swing.JSpinner.NumberEditor方法的典型用法代碼示例。如果您正苦於以下問題:Java JSpinner.NumberEditor方法的具體用法?Java JSpinner.NumberEditor怎麽用?Java JSpinner.NumberEditor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JSpinner
的用法示例。
在下文中一共展示了JSpinner.NumberEditor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: JLongSpinner
import javax.swing.JSpinner; //導入方法依賴的package包/類
/**
* Constructs a new {@code JLongSpinner}.
*/
public JLongSpinner() {
super(new SpinnerNumberModel((Long) 0L, (Long) DEFAULT_MIN_VALUE, (Long) DEFAULT_MAX_VALUE,
(Long) DEFAULT_STEP_SIZE));
this.minValue = DEFAULT_MIN_VALUE;
this.maxValue = DEFAULT_MAX_VALUE;
final JSpinner.NumberEditor editor = new JSpinner.NumberEditor(this);
editor.getFormat().setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
setEditor(editor);
final Dimension minimumSize = getMinimumSize();
minimumSize.width = SPINNER_WIDTH;
setMinimumSize(minimumSize);
final Dimension preferredSize = getPreferredSize();
preferredSize.width = SPINNER_WIDTH;
setPreferredSize(preferredSize);
}
示例2: JDoubleSpinner
import javax.swing.JSpinner; //導入方法依賴的package包/類
/**
* Constructs a new {@code JDoubleSpinner}.
*/
public JDoubleSpinner() {
super(new SpinnerNumberModel(0.0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, DEFAULT_STEP_SIZE));
this.minValue = DEFAULT_MIN_VALUE;
this.maxValue = DEFAULT_MAX_VALUE;
final JSpinner.NumberEditor editor = new JSpinner.NumberEditor(this);
editor.getFormat().setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
setEditor(editor);
}