本文整理汇总了Java中javax.swing.JSpinner.setEditor方法的典型用法代码示例。如果您正苦于以下问题:Java JSpinner.setEditor方法的具体用法?Java JSpinner.setEditor怎么用?Java JSpinner.setEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JSpinner
的用法示例。
在下文中一共展示了JSpinner.setEditor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ComparePanel
import javax.swing.JSpinner; //导入方法依赖的package包/类
public ComparePanel()
{
dateSpinner = new JSpinner( new SpinnerDateModel() );
JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(dateSpinner, "dd.MM.yyyy");
dateSpinner.setEditor(dateEditor);
dateSpinner.setValue(new Date());
timeSpinner = new JSpinner( new SpinnerDateModel() );
JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "HH:mm:ss");
timeSpinner.setEditor(timeEditor);
timeSpinner.setValue(new Date());
}
示例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;
}
示例4: createSchedulerPanel
import javax.swing.JSpinner; //导入方法依赖的package包/类
Box createSchedulerPanel() {
Box box = Box.createVerticalBox();
box.setOpaque(false);
box.setBorder(new EmptyBorder(10, 0, 0, 10));
Box b0 = Box.createHorizontalBox();
schedule = new JCheckBox(getString("LBL_Q"));
schedule.setContentAreaFilled(false);
schedule.setFocusPainted(false);
// schedule.addActionListener(this);
b0.add(schedule);
b0.setBorder(new EmptyBorder(0, 0, 10, 0));
b0.add(Box.createHorizontalGlue());
box.add(b0);
start = new SpinnerDateModel();
end = new SpinnerDateModel();
startDate = new JSpinner(start);
startDate.setEditor(new JSpinner.DateEditor(startDate,
"dd-MMM-yy hh:mm a"));
startDate.setMaximumSize(startDate.getPreferredSize());
endDate = new JSpinner(end);
endDate
.setEditor(new JSpinner.DateEditor(endDate, "dd-MMM-yy hh:mm a"));
endDate.setMaximumSize(endDate.getPreferredSize());
Box b1 = Box.createHorizontalBox();
b1.add(new JLabel(getString("LBL_START_Q")));
b1.add(Box.createHorizontalGlue());
b1.add(startDate);
box.add(b1);
box.add(Box.createRigidArea(new Dimension(10, 10)));
Box b2 = Box.createHorizontalBox();
b2.add(new JLabel(getString("LBL_STOP_Q")));
b2.add(Box.createHorizontalGlue());
b2.add(endDate);
box.add(b2);
return box;
}