第一范文网 - 专业文章范例文档资料分享平台

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

来源:用户分享 时间:2025/5/22 8:55:20 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

}*/

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(){

Java课程设计实验报告及全部源码流程图.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c37rz8979i0862m61dlgf_6.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top