欢迎来到天天文库
浏览记录
ID:38621360
大小:73.50 KB
页数:7页
时间:2019-06-16
《南昌大学实验报告格式》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、南昌大学实验报告学生姓名:白飞龙学号:8001709001专业班级:信安091班实验类型:□验证□综合□设计□创新实验日期:实验成绩:(以下主要内容由学生完成)一、实验项目名称二、实验目的三、实验基本原理四、主要仪器设备及耗材五、实验步骤六、实验数据及处理结果importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.util.*;publicclasscalendar{//main主函数publicstaticvoidmain(String[]a
2、rgs){CalenderTrainwindow=newCalenderTrain();}}classCalenderTrainextendsJFrameimplementsActionListener{//月份下拉列表框JComboBoxMonth=newJComboBox();//年份下拉列表框JComboBoxYear=newJComboBox();LabelYear_l=newLabel("Year");LabelMonth_l=newLabel("Month");JButton[]button_day=newJButt
3、on[49];Buttonbutton_ok=newButton("Confirm");//button_ok.setBackground(Color.blue);Buttonbutton_exit=newButton("Exit");//button_exit.setBackground(Color.blue);//Button_ok.setSize(20,5);Buttonbutton_today=newButton("ShowToday");//button_today.setBackground(Color.blue);
4、booleansignal=false;//存放年份Stringyear_int=null;//存放月份intmonth_int;//放置下拉列表框JPanelpane1=newJPanel();//放置日期面板JPanelpane2=newJPanel();//放置查询按钮与今天按钮JPanelpane3=newJPanel();JPanelpane_parent=newJPanel();Datenow_date=newDate();intnow_year=now_date.getYear()+1900;intnow_mont
5、h=now_date.getMonth();//定义方法绘制面板publicCalenderTrain(){super("日历");setDefaultCloseOperation(DISPOSE_ON_CLOSE);addWindowListener(newWindowAdapter(){publicvoidwindowClose(WindowEvente){System.out.print("CLOSINGTHEWIN");System.exit(0);}});setResizable(true);//设定年月for(int
6、i=now_year-2010;i<=now_year+2010;i++){//添加年份选项ItemYear.addItem(i+"");}//在月份下拉列表上添加年份选项Itemfor(inti=1;i<13;i++){Month.addItem(i+"");}//窗口初始显示时间//设定年份下拉列表为当前年份Year.setSelectedIndex(now_year);pane1.add(Year);pane1.add(Year_l);//设定月份下拉列表为当前月份Month.setSelectedIndex(now_mo
7、nth);pane1.add(Month);pane1.add(Month_l);pane1.add(button_ok);pane3.add(button_today);pane3.add(button_exit);button_ok.addActionListener(this);button_exit.addActionListener(this);button_today.addActionListener(this);//初始化日期按钮并绘制//采用GDL网格布局,七行七列pane2.setLayout(newGrid
8、Layout(7,7,10,10));for(inti=0;i<49;i++){//初始化按钮button_day[i]=newJButton("");//添加天数按钮pane2.add(button_day[i]);}this.setDay();//调用set
此文档下载收益归作者所有