云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > java万年历设计报告

java万年历设计报告

  • 62 次阅读
  • 3 次下载
  • 2025/7/4 23:44:36

5

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

import java.awt.event.*;

public class Month extends Box implements ActionListener//ActionListener接口 {

int month;

JTextField showMonth=null; JButton RMonth,NMonth; CalendarPad cal;

public Month(CalendarPad c) {

super(BoxLayout.X_AXIS); this.cal=c;

showMonth=new JTextField(2); month=c.getMonth();

showMonth.setEditable(false);

showMonth.setForeground(Color.blue); showMonth.setFont(new Font(\NMonth=new JButton(\下月\RMonth=new JButton(\上月\ add(RMonth); add(showMonth); add(NMonth);

RMonth.addActionListener(this); NMonth.addActionListener(this); showMonth.setText(\ }

public void setMonth(int month) {

if(month<=12&&month>=1) {

this.month=month; } else {

this.month=1; }

showMonth.setText(\ }

public int getMonth() {

return month; }

6

public void actionPerformed(ActionEvent e) {

if(e.getSource()==RMonth) {

if(month>=2) {

month=month-1; cal.setMonth(month);

cal.setCal(cal.getYear(),month); }

else if(month==1) {

month=12;

cal.setMonth(month);

cal.setCal(cal.getYear(),month); }

showMonth.setText(\ }

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

if(month<12) {

month=month+1; cal.setMonth(month);

cal.setCal(cal.getYear(),month); }

else if(month==12) {

month=1;

cal.setMonth(month);

cal.setCal(cal.getYear(),month); }

showMonth.setText(\ } } }

//对年分的选择

package javaapplication13;

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

import java.awt.event.*;

public class Year extends Box implements ActionListener//ActionListener接口

7

{

int year;

JTextField showYear=null; JButton NYear,RYear; CalendarPad cal;

public Year(CalendarPad c) {

super(BoxLayout.X_AXIS); showYear=new JTextField(4); showYear.setForeground(Color.blue); showYear.setFont(new Font(\ this.cal=c;

year=cal.getYear();

NYear=new JButton(\下年\RYear=new JButton(\上年\ add(RYear); add(showYear); add(NYear);

showYear.addActionListener(this); RYear.addActionListener(this); NYear.addActionListener(this); }

public void setYear(int year) {

this.year=year;

showYear.setText(\ }

public int getYear() {

return year; }

public void actionPerformed(ActionEvent e) {

if(e.getSource()==RYear) {

year=year-1;

showYear.setText(\ cal.setYear(year);

cal.setCal(year,cal.getMonth()); }

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

year=year+1;

showYear.setText(\

8

cal.setYear(year);

cal.setCal(year,cal.getMonth()); }

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

try {

year=Integer.parseInt(showYear.getText()); showYear.setText(\ cal.setYear(year);

cal.setCal(year,cal.getMonth()); }

catch(NumberFormatException ee) {

showYear.setText(\ cal.setYear(year);

cal.setCal(year,cal.getMonth()); } } } }

//对备忘录的操作

package javaapplication13;

import java.awt.*;

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

import javax.swing.event.*; import java.io.*;

public class NotePad extends JPanel implements ActionListener {

JTextArea text; JButton save_log,del_log; Hashtable table; JLabel mes_label; int year,month,day; File file;

CalendarPad calendar;

public NotePad(CalendarPad calendar)//构造函数 {

this.calendar=calendar;

Calendar now = Calendar.getInstance();

搜索更多关于: java万年历设计报告 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

5 import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Month extends Box implements ActionListener//ActionListener接口 { int month; JTextField showMonth=null; JButton RMonth,NMonth; CalendarPad cal; public Month(CalendarPad c) { super(BoxLayout.X_AXIS); this.cal=c; showMonth=new JTextField(

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com