當前位置: 首頁>>代碼示例>>Java>>正文


Java JSpinner.setEditor方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:13,代碼來源:JSpinnerJavaElementTest.java

示例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()); 
	
}
 
開發者ID:fossasia,項目名稱:zooracle,代碼行數:13,代碼來源:ComparePanel.java

示例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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:JSpinnerJavaElementTest.java

示例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;
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:46,代碼來源:ConfigDialog.java


注:本文中的javax.swing.JSpinner.setEditor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。