本文整理汇总了Java中javax.swing.SpinnerNumberModel.addChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java SpinnerNumberModel.addChangeListener方法的具体用法?Java SpinnerNumberModel.addChangeListener怎么用?Java SpinnerNumberModel.addChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.SpinnerNumberModel
的用法示例。
在下文中一共展示了SpinnerNumberModel.addChangeListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDetails
import javax.swing.SpinnerNumberModel; //导入方法依赖的package包/类
private JComponent createDetails()
{
JLabel titleLabel = new JLabel(CurrentLocale.get("wizard.controls.title")); //$NON-NLS-1$
JLabel descriptionLabel = new JLabel(CurrentLocale.get("wizard.controls.description")); //$NON-NLS-1$
JLabel nounLabel = new JLabel(CurrentLocale.get("wizard.controls.repeatnoun")); //$NON-NLS-1$
JLabel minLabel = new JLabel(CurrentLocale.get("wizard.controls.minoccurrences")); //$NON-NLS-1$
JLabel maxLabel = new JLabel(CurrentLocale.get("wizard.controls.maxoccurrences")); //$NON-NLS-1$
title = new I18nTextField(BundleCache.getLanguages());
description = new I18nTextField(BundleCache.getLanguages());
noun = new I18nTextField(BundleCache.getLanguages());
// Setup the number spinners
minModel = new SpinnerNumberModel(1, 0, 50, 1);
maxModel = new SpinnerNumberModel(10, 0, 500, 1);
minModel.addChangeListener(this);
maxModel.addChangeListener(this);
final int height1 = title.getPreferredSize().height;
final int width1 = maxLabel.getPreferredSize().width;
final int[] rows = {height1, height1, height1, height1, height1,};
final int[] cols = {width1, TableLayout.FILL, TableLayout.DOUBLE_FILL,};
JPanel all = new JPanel(new TableLayout(rows, cols));
all.add(titleLabel, new Rectangle(0, 0, 1, 1));
all.add(title, new Rectangle(1, 0, 2, 1));
all.add(descriptionLabel, new Rectangle(0, 1, 1, 1));
all.add(description, new Rectangle(1, 1, 2, 1));
all.add(nounLabel, new Rectangle(0, 2, 1, 1));
all.add(noun, new Rectangle(1, 2, 2, 1));
all.add(minLabel, new Rectangle(0, 3, 1, 1));
all.add(new JSpinner(minModel), new Rectangle(1, 3, 1, 1));
all.add(maxLabel, new Rectangle(0, 4, 1, 1));
all.add(new JSpinner(maxModel), new Rectangle(1, 4, 1, 1));
return all;
}