当前位置: 首页>>代码示例>>Java>>正文


Java SpinnerDateModel类代码示例

本文整理汇总了Java中javax.swing.SpinnerDateModel的典型用法代码示例。如果您正苦于以下问题:Java SpinnerDateModel类的具体用法?Java SpinnerDateModel怎么用?Java SpinnerDateModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SpinnerDateModel类属于javax.swing包,在下文中一共展示了SpinnerDateModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTimePanel

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
private JPanel createTimePanel() {
    JPanel newPanel = new JPanel();
    newPanel.setLayout(new FlowLayout());
    Date date = getDate();
    if (date == null) {
        Calendar calendar = Calendar.getInstance(timeZone);
        date = calendar.getTime();
    }
    SpinnerDateModel dateModel = new SpinnerDateModel(date, null, null, Calendar.DAY_OF_MONTH);
    timeSpinner = new JSpinner(dateModel);
    if (timeFormat == null) {
        timeFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
    }
    updateTextFieldFormat();
    newPanel.add(new JLabel("Time:"));
    newPanel.add(timeSpinner);
    newPanel.setBackground(Color.WHITE);
    return newPanel;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:DateTimePicker.java

示例2: createDateSpinner

import javax.swing.SpinnerDateModel; //导入依赖的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

示例3: ComparePanel

import javax.swing.SpinnerDateModel; //导入依赖的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

示例4: createDateSpinner

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
static void createDateSpinner() {
    Calendar calendar = Calendar.getInstance();
    Date initDate = calendar.getTime();
    calendar.add(Calendar.YEAR, -1);
    Date earliestDate = calendar.getTime();
    calendar.add(Calendar.YEAR, 1);
    Date latestDate = calendar.getTime();
    SpinnerModel dateModel = new SpinnerDateModel(initDate,
            earliestDate,
            latestDate,
            Calendar.YEAR);
    spinner = new JSpinner();
    spinner.setModel(dateModel);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:bug8008657.java

示例5: createPanel2

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
private JPanel createPanel2()
{
  JPanel panel = new JPanel(new BorderLayout());
  this.spinnerState2 = new JCheckBox("Enabled", true);
  this.spinnerState2.setActionCommand("COMBO_STATE2");
  this.spinnerState2.addActionListener(this);
  panel.add(this.spinnerState2, BorderLayout.EAST);

  JPanel controlPanel = new JPanel();
  controlPanel.setBorder(BorderFactory.createTitledBorder("Date Spinner: "));
  this.spinner3 = new JSpinner(new SpinnerDateModel(new Date(), null, null,
      Calendar.DATE));

  this.spinner4 = new JSpinner(new SpinnerDateModel(new Date(), null, null,
      Calendar.YEAR));
  this.spinner4.setFont(new Font("Dialog", Font.PLAIN, 20));

  controlPanel.add(this.spinner3);
  controlPanel.add(this.spinner4);

  panel.add(controlPanel);

  return panel;
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:SpinnerDemo.java

示例6: main

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
public static void main(String[] args) {
    JFrame jf = new JFrame("It Spins");
    Container cp = jf.getContentPane();
    cp.setLayout(new GridLayout(0,1));

    // Create a JSpinner using one of the pre-defined SpinnerModels
    JSpinner dates = new JSpinner(new SpinnerDateModel());
    cp.add(dates);

    // Create a JSPinner using a SpinnerListModel. 
    String[] data = { "One", "Two", "Three" };
    JSpinner js = new JSpinner(new SpinnerListModel(data));
    cp.add(js);

    jf.setSize(100, 80);
    jf.setVisible(true);
}
 
开发者ID:shashanksingh28,项目名称:code-similarity,代码行数:18,代码来源:SpinnerDemo.java

示例7: DatePickerPanel

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
public DatePickerPanel(Date date) {
        super(new FlowLayout());

        this.date = date;

        // is null checkbox
        cbIsNull = new JCheckBox();
        cbIsNull.setToolTipText("is null?");

        // date text field
        smDateModel = new SpinnerDateModel();
        spDate = new JSpinner(smDateModel);

        cbIsNull.setSelected(date == null);
        spDate.setEnabled(date != null);
        if (date != null) {
                smDateModel.setValue(date);
        }

        cbIsNull.addItemListener(new CheckboxListener());
        spDate.addChangeListener(new DatePickerListener());

        add(cbIsNull);
        add(spDate);
}
 
开发者ID:iig-uni-freiburg,项目名称:SWAT20,代码行数:26,代码来源:TimeFilterDialog.java

示例8: createPanel2

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
private JPanel createPanel2() 
{
  JPanel panel = new JPanel(new BorderLayout());
  this.spinnerState2 = new JCheckBox("Enabled", true);
  this.spinnerState2.setActionCommand("COMBO_STATE2");
  this.spinnerState2.addActionListener(this);
  panel.add(this.spinnerState2, BorderLayout.EAST);
      
  JPanel controlPanel = new JPanel();
  controlPanel.setBorder(BorderFactory.createTitledBorder("Date Spinner: "));
  this.spinner3 = new JSpinner(new SpinnerDateModel(new Date(), null, null, 
      Calendar.DATE));
      
  this.spinner4 = new JSpinner(new SpinnerDateModel(new Date(), null, null, 
      Calendar.YEAR));
  this.spinner4.setFont(new Font("Dialog", Font.PLAIN, 20));
      
  controlPanel.add(this.spinner3);
  controlPanel.add(this.spinner4);
      
  panel.add(controlPanel);
   
  return panel;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:25,代码来源:SpinnerDemo.java

示例9: interactiveDatePickerNimbus

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
/**
 * Issue #913-swingx: Datepicker looks bad in some LFs (f.i. Nimbus)
 * 
 * not only Nimbus ...
 * - Metal: starts with different height than textfield, shrinks when coming
 *   back from another LF
 * - motif: button is shrunkenn always
 * - win: halfway okay, but should have buttons "nearer/integrated" to the field
 *   as spinner, combo does
 * - Vista: button should visually "merge" into field until rollover (as combo does,
 *   Spinner not
 * - Can't remember the reason why combo's button isn't re-used?
 *       
 */
public void interactiveDatePickerNimbus() {
    JXDatePicker picker = new JXDatePicker(new Date());
    JFormattedTextField field = new JFormattedTextField();
    field.setValue(picker.getDate());
    JSpinner spinner = new JSpinner(new SpinnerDateModel());
    spinner.setValue(picker.getDate());
    JComboBox box = new JComboBox(new Object[] {picker.getDate()});
    box.setEditable(true);
    JComponent panel = new JXPanel();
    panel.add(field);
    panel.add(picker);
    panel.add(spinner);
    panel.add(box);
    showInFrame(panel, "Nimbus and picker");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:30,代码来源:JXDatePickerIssues.java

示例10: DateFilterPanel

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
public DateFilterPanel() {
    filter = new DateFilter();
    
    firstModel = new SpinnerDateModel();
    lastModel = new SpinnerDateModel();
    beforeModel = new SpinnerDateModel();
    afterModel = new SpinnerDateModel();
    daysModel = new SpinnerNumberModel(1, 0, 3000, 1);
    
    initComponents();
    
    firstSpinner.setModel(firstModel);
    lastSpinner.setModel(lastModel);
    beforeSpinner.setModel(beforeModel);
    afterSpinner.setModel(afterModel);
    daysSpinner.setModel(daysModel);
    
    firstSpinner.setEditor(new JSpinner.DateEditor(firstSpinner, "yyyy/MM/dd"));
    lastSpinner.setEditor(new JSpinner.DateEditor(lastSpinner, "yyyy/MM/dd"));
    beforeSpinner.setEditor(new JSpinner.DateEditor(beforeSpinner, "yyyy/MM/dd"));
    afterSpinner.setEditor(new JSpinner.DateEditor(afterSpinner, "yyyy/MM/dd"));
    
    setDateFilter(filter);
}
 
开发者ID:msanpopo,项目名称:kgsview,代码行数:25,代码来源:DateFilterPanel.java

示例11: makeDate

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
private static JSpinner makeDate(Controller c, String source,
        GridBagLayout gbl, GridBagConstraints con) {
    JSpinner dt = new JSpinner();
    SpinnerModel sm = new SpinnerDateModel();
    dt.setModel(sm);
    JSpinner.DateEditor editor = (JSpinner.DateEditor)dt.getEditor();
    JTextField txt = editor.getTextField();
    txt.setForeground(Color.WHITE);
    txt.setBackground(new Color(55, 55, 55));
    txt.setCaretColor(Color.WHITE);
    gbl.setConstraints(dt, con);
    if (source.startsWith("#")) {
        c.bind(dt, source.substring(1));
    } else {
        dt.setValue(source);
    }
    return dt;
}
 
开发者ID:dogriffiths,项目名称:hipster,代码行数:19,代码来源:XMLPanel.java

示例12: addDateControls

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
protected void addDateControls() {
	dateNowRadionButton = new JRadioButton();
	dateNowRadionButton.setSelected(true);
	dateLabel = builder.append("", dateNowRadionButton);
	builder.nextLine();
	
	dateLaterRadionButton = new JRadioButton();
	dateModel = new SpinnerDateModel();
	final JSpinner dateSpinner = new JSpinner(dateModel);
	dateSpinner.setEnabled(false);
	dateLaterRadionButton.addChangeListener(new ChangeListener() {
		public void stateChanged(ChangeEvent e) {
			dateSpinner.setEnabled(dateLaterRadionButton.isSelected());
		}			
	});
	builder.append("", dateLaterRadionButton, dateSpinner);
	builder.nextLine();
	
	ButtonGroup buttonGroup = new ButtonGroup();
	buttonGroup.add(dateNowRadionButton);
	buttonGroup.add(dateLaterRadionButton);		
}
 
开发者ID:Distrotech,项目名称:jhylafax,代码行数:23,代码来源:AbstractFaxDialog.java

示例13: DatabaseRow

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
public DatabaseRow(String aff, Membership member) {
  this.sailor = member;
  this.affiliation = aff;
  this.editable = member.isNew();
  this.nameField = new JTextField(member.getName());
  this.nameField.setEditable(this.editable);
  // Year
  SpinnerDateModel sm = new SpinnerDateModel(member.getYear(),
		 null,
		 null,
		 Calendar.YEAR);
  this.yearSpinner = new JSpinner(sm);
  yearSpinner.setEditor(new JSpinner.DateEditor(yearSpinner,
		    "yyyy"));
  this.yearSpinner.setEnabled(this.editable);
  // Edit and delete buttons
  this.delBut = Factory.tightButton(new DelSailorAction());
  this.editBut= Factory.tightButton(new EditSailorAction());
}
 
开发者ID:RandomWidgets,项目名称:TechScore,代码行数:20,代码来源:RPDatabasePane.java

示例14: MissingDatePanel

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
public MissingDatePanel(DateAndTime dateAndTime) {
	super(dateAndTime);
	GregorianCalendar calendar = new GregorianCalendar();
	Date initDate = calendar.getTime();
	calendar.add(Calendar.YEAR, -100);
	Date earliestDate = calendar.getTime();
	calendar.add(Calendar.YEAR, 200);
	Date latestDate = calendar.getTime();
	dateModel = new SpinnerDateModel(initDate, earliestDate, latestDate, Calendar.YEAR);
	dateSpinner = new JSpinner(dateModel);
	dateSpinner.setEditor(new JSpinner.DateEditor(dateSpinner, "yyyy-MM-dd"));
	
	this.setLayout(new FlowLayout(FlowLayout.LEFT));
	this.add(dateLabel);
	this.add(dateSpinner);
}
 
开发者ID:52North,项目名称:sos-importer,代码行数:17,代码来源:MissingDatePanel.java

示例15: MissingTimePanel

import javax.swing.SpinnerDateModel; //导入依赖的package包/类
public MissingTimePanel(DateAndTime dateAndTime) {
	super(dateAndTime);
	timeModel = new SpinnerDateModel();
	GregorianCalendar gc = new GregorianCalendar(0, 0, 0, 0, 0, 0);
	timeModel.setValue(gc.getTime());
	timeModel.setCalendarField(Calendar.HOUR_OF_DAY);
	timeSpinner = new JSpinner(timeModel);
	timeSpinner.setEditor(new JSpinner.DateEditor(timeSpinner, "HH:mm:ss"));
	
	this.setLayout(new FlowLayout(FlowLayout.LEFT));
	
	this.timeLabel = new JLabel(Lang.l().time() + ": ");
	
	this.add(timeLabel);
	this.add(timeSpinner);
}
 
开发者ID:52North,项目名称:sos-importer,代码行数:17,代码来源:MissingTimePanel.java


注:本文中的javax.swing.SpinnerDateModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。