类图

该万年历设计的类如下:

主类MillionYear:设计了该万年历的图形界面,用JPanel类创建了一个比较简单的布局。其中用两个JComboBox组件形成了年和月的下拉列表,可以显示从1800年到2100年的所有日期;用JTable组件把日期按照平常的月历显示出来。

类Solar:该类处理了公历。在其中判断了这一年是否是闰年,月份的天数,指定月份的一号对应的星期等。

类Lunar:处理农历的类。该类能把对应日期的阴历显示出来。

类Clock:显示了系统的时间。该类调用线程取得系统时间并显示。

对应的UML类图:

类MillionYear

 

         MillionYear

- solar:Solar

- selectedYear:int

- selectedMonth:int

- daysOfMonth:int

-weekOfFirstDay:int    

- lunar:Lunar

- top:JPanel

- jcb1:JComboBox

- jcb2:JComboBox

- table:JTable

 -showNew():void

 +update(g:Graphics):void

 +itemStateChanged(e:ItemEvent):void

 +main(args:String[] ):void

类Sorlar

               Sorlar

 #todayYear:int

 #todayMonth:int

 #todayDay:int

 #todayWeek:int

 #getDaysOfMonth(year:int,month:int):int

 #getWeekOfFirstDay(year:int,month:int ):int

 -prt(k:int):void

类Lunar

               Lunar

-temp_total_day:int

-gc_solar_calendar_year:int

- gc_solar_calendar_month:int

- gc_solar_calendar_dateint:

- gc_lunar_calendar_year:int

gc_lunar_calendar_month:int

gc_lunar_calendar_date:int

- start_day_of_week:int

 +get_solar_day_date():void

 +calendar_calculate_lunar_month_total_day():int

 +get_lunar_day():void

类Clock

                Clock

-serialVersionUID:final long= 3660124045489727166L

my:MillionYear

t:Thread

time:String

+Clock(my:MillionYear)

+run():void

+paint(g:Graphics ):void

转载于:https://www.cnblogs.com/yue7/p/4557345.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值