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


Java SpinnerDateModel.setCalendarField方法代码示例

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


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

示例1: 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

示例2: createView

import javax.swing.SpinnerDateModel; //导入方法依赖的package包/类
private void createView() {

        frame = new JFrame(title);
        dateLabel = new JLabel("Data :");
        entryLabel = new JLabel("Entrada :");
        exitLabel = new JLabel("Saída :");
        dateField = new JTextField();
        //  entryField = new JTextField();
        // exitField = new JTextField();
        okButton = new JButton("OK");
        cancelButton = new JButton("Cancelar");

        SpinnerDateModel modelEntry = new SpinnerDateModel();
        modelEntry.setCalendarField(Calendar.MINUTE);
        SpinnerDateModel modelExit = new SpinnerDateModel();
        modelExit.setCalendarField(Calendar.MINUTE);
        entryField = new JSpinner();
        entryField.setModel(modelEntry);
        entryField.setEditor(new JSpinner.DateEditor(entryField, "HH:mm:ss"));
        exitField = new JSpinner();
        exitField.setModel(modelExit);
        exitField.setEditor(new JSpinner.DateEditor(exitField, "HH:mm:ss"));

        DocumentFilter dateDocumentFilter = new DateDocumentFilter();
        ((AbstractDocument) dateField.getDocument()).setDocumentFilter(dateDocumentFilter);


        frame.setLayout(null);
        takeScreenSize();
        frame.setBounds((x - 500) / 2, (y - 350) / 2, 500, 350);
        dateLabel.setBounds(50, 50, 100, 30);
        entryLabel.setBounds(50, 100, 100, 30);
        exitLabel.setBounds(50, 150, 100, 30);
        dateField.setBounds(150, 50, 150, 30);
        entryField.setBounds(150, 100, 150, 30);
        exitField.setBounds(150, 150, 150, 30);
        okButton.setBounds(100, 250, 125, 30);
        cancelButton.setBounds(250, 250, 125, 30);

        dateLabel.setFont(FontFactory.getFontDefault());
        entryLabel.setFont(FontFactory.getFontDefault());
        exitLabel.setFont(FontFactory.getFontDefault());
        dateField.setFont(FontFactory.getFontDefault());
        entryField.setFont(FontFactory.getFontDefault());
        exitField.setFont(FontFactory.getFontDefault());
        okButton.setFont(FontFactory.getFontLarge());
        cancelButton.setFont(FontFactory.getFontLarge());

        dateLabel.setBackground(Color.BLACK);
        entryLabel.setBackground(Color.BLACK);
        exitLabel.setBackground(Color.BLACK);
        dateField.setForeground(Color.BLACK);
        entryField.setForeground(Color.BLACK);
        exitField.setForeground(Color.BLACK);
        okButton.setForeground(Color.BLACK);
        cancelButton.setForeground(Color.BLACK);
        frame.getContentPane().setBackground(Color.WHITE);



        frame.add(dateLabel);
        frame.add(entryLabel);
        frame.add(exitLabel);
        frame.add(dateField);
        frame.add(entryField);
        frame.add(exitField);
        frame.add(okButton);
        frame.add(cancelButton);


        JContextPopupMenu contextPopupMenu = new JContextPopupMenu();

        //adiciona evento aos itens do popupmenu
        contextPopupMenu.addInComponet(dateField);

        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    }
 
开发者ID:jmayer13,项目名称:academia_biometria,代码行数:79,代码来源:AddPointFrame.java


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