matengmin的gravatar头像
matengmin 2015-05-11 09:17:28

使用java Timer类实现在swing面板上显示动态时钟

解压包,复制到自己的包下,修改成自己的包名,即可运行。

画出一个时钟,首先要画一个圆和三个表示秒、分、时的表针。

		// Draw minute hand
		int mLength = (int) (clockRadius * 0.65);
		int xMinute = (int) (xCenter + mLength
				* Math.sin(minute * (2 * Math.PI / 60)));
		int yMinute = (int) (yCenter - mLength
				* Math.cos(minute * (2 * Math.PI / 60)));
		g.setColor(Color.blue);
		g.drawLine(xCenter, yCenter, xMinute, yMinute);

项目截图:

两个类,DClock继承StillClock。

使用java Timer类实现在swing面板上显示动态时钟

运行截图:

简单的动态钟表

使用java Timer类实现在swing面板上显示动态时钟


打赏

文件名:Dclock.zip,文件大小:1.568K 下载
最代码最近下载分享源代码列表最近下载
Kunyuu  LV1 2023年12月26日
另类清晨  LV8 2023年5月15日
微信网友_5992582549164032  LV6 2022年6月21日
段朝洪  LV15 2020年11月21日
liangge2115  LV27 2020年10月17日
刘晨娜  LV1 2020年7月24日
15966848095  LV22 2020年1月12日
wenxiaozhong  LV1 2019年12月18日
如风太过分人  LV1 2019年12月17日
yongzheng132  LV17 2019年6月21日
最代码最近浏览分享源代码列表最近浏览
Kunyuu  LV1 2023年12月26日
wuyongjian 2023年6月29日
暂无贡献等级
luo110012  LV9 2023年5月15日
另类清晨  LV8 2023年5月15日
想把它染成绿色 2023年3月1日
暂无贡献等级
Willson88888  LV3 2022年12月7日
微信网友_6248713511227392  LV11 2022年12月5日
一起吹过晚风的街  LV1 2022年9月21日
微信网友_5992582549164032  LV6 2022年6月21日
猪皮怪 2022年6月12日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友