小弟跪求java小程序多功能指针时钟

来源:百度知道 编辑:UC知道 时间:2024/05/26 10:00:22
学校实习,需要做一个java指针时钟,有定时功能,能显示日历,并能在日历上连接记事本,记录某天的事情!!跪求大哥给解决。

这个太难了,我这里只有最简单的时钟功能的实现=。=
import java.awt.*;
import javax.swing.*;
import java.util.*;

public class Clock extends JFrame {
public Clock() {
ClockPaint cp = new ClockPaint(20, 20, 70);

this.add(cp);
this.setSize(200, 200);
this.setResizable(false);
this.setLocation(260, 120);
this.setTitle("小时钟");
this.setVisible(true);
}
public static void main(String[] s) {
new Clock();
}
}
class ClockPaint extends JPanel implements Runnable {
int x, y, r;
int h, m, s;//小时,分钟,秒
double rad = Math.PI / 180;
public ClockPaint(int x, int y, int r) {
this.x = x;
this.y = y;
this.r = r;
Calendar now = new GregorianCalendar();
s = now.get(Calendar.SECOND) * 6;//获得秒转换成度数
m = now.get(Calendar.MINUTE) * 6;//获得分钟
h = (now.get(Calendar.HOUR_OF_DAY) - 12) * 30 + now.get(Calendar.MINUTE) / 12 * 6;//获得小时