Java课程设计实验报告及全部源码流程图(6)

2020-04-18 07:13

}*/

switch(month_num){

case 0:setBG(\

case 1:setBG(\ case 2:setBG(\ case 3:setBG(\ case 4:setBG(\ case 5:setBG(\ case 6:setBG(\ case 7:setBG(\ case 8:setBG(\ case 9:setBG(\ case 10:setBG(\ case 11:setBG(\ } updateUI();

} public void actionPerformed(ActionEvent e) { if (e.getSource() == Year || e.getSource() == Month) { this.setYM();

this.setImg(month_num); this.setDay();

}

else if(e.getSource()==Up1){ this.setYM(); if(month_num==11){ int y=Integer.parseInt(year_num); y++;

this.setYM(); month_num=0;

Month.setSelectedIndex(month_num); year_num=Integer.toString(y); Year.setText(year_num);

this.setImg(month_num);

}

}

this.setDay();

else{ }

Month.setSelectedIndex(++month_num); this.setDay();

this.setImg(month_num);

else if(e.getSource()==Down1){ }

else if(e.getSource()==Down2){

this.setYM();

int y=Integer.parseInt(year_num); y--;

this.setYM();

year_num=Integer.toString(y); Year.setText(year_num); this.setDay(); this.setYM(); if(month_num==0){ } else{ }

Month.setSelectedIndex(--month_num); this.setDay();

this.setImg(month_num);

int y=Integer.parseInt(year_num); y--;

this.setYM(); month_num=11;

Month.setSelectedIndex(month_num); year_num=Integer.toString(y); Year.setText(year_num); this.setDay();

}

}

this.setImg(month_num);

else if(e.getSource()==Up2){ }

else if(e.getSource()==Today){ }

bool=true; this.setYM(); this.setDay();

Year.setText(year_num);

Month.setSelectedIndex(month_num); this.setYM();

int y=Integer.parseInt(year_num); y++;

this.setYM();

year_num=Integer.toString(y); Year.setText(year_num); this.setDay();

this.setImg(month_num);

this.setImg(month_num);

public void Button_dayyearboxActionPerformed(ActionEvent e){ strbuttonday=e.getActionCommand(); };

public int getDay(){

strbuttonyear=Year.getText(); day=Integer.parseInt(strbuttonday);

strbuttonmonth=Month.getSelectedIndex()+1+\

if(strbuttonday.length()<2){strbuttonday=\if(strbuttonmonth.length()<2){strbuttonmonth=\

//day=calendar.get(DAY_OF_MONTH); return day;}

public void paintComponent(Graphics g){

} }

super.paintComponent(g);

ImageIcon img=new ImageIcon(background); g.drawImage(img.getImage(),0,0,1150,750,this);

这里主要用来定义日历的排版布局,给日历添加监听,使其能实现日历的翻页、相关背景的变换、点击日历上相应按钮能显示时钟及备忘录等功能。

Clock.java

import java.awt.*; import javax.swing.*;

import java.applet.AudioClip; import java.io.*;

import java.applet.Applet;

import java.net.MalformedURLException; import java.net.URL; import

java.awt.event.ActionListener;

import

java.awt.event.ActionEvent;

import java.util.Calendar; import java.lang.String;

public class Clock extends JFrame { public Clock(){

DrawClock dc=new DrawClock(); add(dc,BorderLayout.CENTER); setSize(640,560); setVisible(true);

setExtendedState(JFrame.MAXIMIZED_BOTH);

//添加计时器 时间间隔为1s int delay1 = 1000;

ActionListener drawClock1 = new ActionListener(){

public void actionPerformed(ActionEvent evt){

//获取当前时间

if(nowh==i && nows==0 && nowm==0){

Calendar now=Calendar.getInstance() ; int nowh= now.get(Calendar.HOUR_OF_DAY); int nowm=now.get(Calendar.MINUTE); int nows=now.get(Calendar.SECOND); int noww=now.get(Calendar.DAY_OF_WEEK);

for(int i=0;i<=23;i++){

//System.out.println(\ try { } }

StringBuffer s=new StringBuffer(\s.append(Integer.toString(i)); s.append(\//System.out.println(s); String st=new String(s); File f = new File(st); URL cb= f.toURL(); AudioClip aau;

aau = Applet.newAudioClip(cb);

aau.play();

} catch (MalformedURLException e) { }

}

};


Java课程设计实验报告及全部源码流程图(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:中国医学独立实验室现状及发展前景分析

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: