预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共14页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

Swing日期控件 一、截图: 二、源代码: packagecom.longtu.rpt.app.view.rptview.multisheet; importjava.util.Calendar; importjavax.swing.JComboBox; importjavax.swing.JTable; importjavax.swing.table.DefaultTableModel; publicclassDateChoiceActive{ //初始化年选择下拉框 publicstaticString[]initItemsYear(){ String[]arrYear=newString[70]; for(inti=1980;i<2050;i++){ arrYear[i-1980]=String.valueOf(i); } returnarrYear; } //初始化月选择下拉框 publicstaticvoidinitItemsMonth(JComboBoxcmbMonth){ cmbMonth.addItem("一月"); cmbMonth.addItem("二月"); cmbMonth.addItem("三月"); cmbMonth.addItem("四月"); cmbMonth.addItem("五月"); cmbMonth.addItem("六月"); cmbMonth.addItem("七月"); cmbMonth.addItem("八月"); cmbMonth.addItem("九月"); cmbMonth.addItem("十月"); cmbMonth.addItem("十一月"); cmbMonth.addItem("十二月"); } publicstaticStringinitComboboxSelected(intmonth){ if(1==month){ return"一月"; }elseif(2==month){ return"二月"; }elseif(3==month){ return"三月"; }elseif(4==month){ return"四月"; }elseif(5==month){ return"五月"; }elseif(6==month){ return"六月"; }elseif(7==month){ return"七月"; }elseif(8==month){ return"八月"; }elseif(9==month){ return"九月"; }elseif(10==month){ return"十月"; }elseif(11==month){ return"十一月"; }else{ return"十二月"; } } publicstaticintgetSelectItemValue(Stringmonth){ if("一月".equals(month)){ return1; }elseif("二月".equals(month)){ return2; }elseif("三月".equals(month)){ return3; }elseif("四月".equals(month)){ return4; }elseif("五月".equals(month)){ return5; }elseif("六月".equals(month)){ return6; }elseif("七月".equals(month)){ return7; }elseif("八月".equals(month)){ return8; }elseif("九月".equals(month)){ return9; }elseif("十月".equals(month)){ return10; }elseif("十一月".equals(month)){ return11; }elseif("十二月".equals(month)){ return12; } return0; } privatestaticintgetCurrentMonthFirstDay(intyear,intmonth){ Calendarnow=Calendar.getInstance(); now.set(year,month-1,1); intweek=now.get(Cal