package tools;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Date;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class MainWinTest2 extends JFrame {
public static void main(String s[]) {
MainWinTest2 mw = new MainWinTest2();
}
public MainWinTest2() {
this.setTitle("下班录入1.0");
this.setSize(1000, 600);
MyDateComp1 m1 = new MyDateComp1();
this.getContentPane().add(m1);
this.setLocation(100, 50);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setVisible(true);
}
}
class MyDateComp1 extends JPanel {
public MyDateComp1() {
initMain();
}
JSpinner year;
SpinnerDateModel model = new SpinnerDateModel();
public void initMain() {
// this.setFont(new Font("宋体",Font.BOLD,16));
// 获得时间日期模型
// 获得JSPinner对象
year = new JSpinner(model);
year.setPreferredSize(new Dimension(180, 30));
year.setFont(new Font("宋体",Font.PLAIN,16));
year.setValue(new Date());
// 设置时间格式
JSpinner.DateEditor editor = new JSpinner.DateEditor(year, "yyyy-MM-dd HH:mm:ss");
year.setEditor(editor);
editor.setEnabled(false);
// year.setBounds(34, 67, 219, 22);
this.add(year);
model.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent arg0) {
// TODO Auto-generated method stub
System.out.println("sdfsdf") ;
}
});
year.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent arg0) {
// TODO Auto-generated method stub
System.out.println("sdfsdf----") ;
}
});
}
}
最近下载更多
最近浏览更多
dddding yang LV6
9月15日
木子520 LV12
5月23日
vitos5n LV10
2024年12月9日
dearxo2014 LV1
2024年11月9日
PSSDZH LV3
2024年6月14日
welcome丶 LV9
2024年4月26日
香菇肉饼汤 LV8
2024年4月21日
小王wang LV10
2024年2月29日
houxianzheng
2024年2月19日
暂无贡献等级
氟西汀来救你 LV2
2024年1月10日

