本文整理匯總了Java中javax.swing.JSpinner.setName方法的典型用法代碼示例。如果您正苦於以下問題:Java JSpinner.setName方法的具體用法?Java JSpinner.setName怎麽用?Java JSpinner.setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JSpinner
的用法示例。
在下文中一共展示了JSpinner.setName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDateSpinner
import javax.swing.JSpinner; //導入方法依賴的package包/類
private JSpinner createDateSpinner(Calendar calendar) {
Date initDate = calendar.getTime();
calendar.add(Calendar.YEAR, -100);
Date earliestDate = calendar.getTime();
calendar.add(Calendar.YEAR, 200);
Date latestDate = calendar.getTime();
SpinnerDateModel spinnerDateModel = new SpinnerDateModel(initDate, earliestDate, latestDate, Calendar.YEAR);
JSpinner dateSpinner = new JSpinner(spinnerDateModel);
dateSpinner.setEditor(new JSpinner.DateEditor(dateSpinner, "MM/yyyy"));
dateSpinner.setName("date-spinner");
return dateSpinner;
}
示例2: createListSpinner
import javax.swing.JSpinner; //導入方法依賴的package包/類
private JSpinner createListSpinner() {
String[] monthStrings = { "January", "February", "March", "April" };
SpinnerListModel spinnerListModel = new SpinnerListModel(monthStrings);
JSpinner listSpinner = new JSpinner(spinnerListModel);
listSpinner.setName("list-spinner");
return listSpinner;
}
示例3: createNumberSpinner
import javax.swing.JSpinner; //導入方法依賴的package包/類
private JSpinner createNumberSpinner(Calendar calendar) {
int currentYear = calendar.get(Calendar.YEAR);
SpinnerModel yearModel = new SpinnerNumberModel(currentYear, currentYear - 100, currentYear + 100, 1);
JSpinner numberSpinner = new JSpinner(yearModel);
numberSpinner.setEditor(new JSpinner.NumberEditor(numberSpinner, "#"));
numberSpinner.setName("number-spinner");
return numberSpinner;
}