本文整理匯總了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;
}