本文整理汇总了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);
}