1,我想在电脑屏幕上设置一个时钟该怎么做啊 超级兔子!或者夜光时钟!桌面时钟!超级兔子桌面秀
2 , 怎样用java 程序写一个时钟程序面向对象思想写成:下面是一个显示器类public class Display private int value;//现在的值private int limit;//上限值Display( int limit) this.limit = limit;}public void increase() value++;if(value =http://www.lisdn.com/sjfx/mzwd/= limit) value = 0;}}public int getValue() return value;}public static void main(String[] args) Display d = new Display(24);for(;;) d.increase();System.out.println(d.getValue());}}}下面创建一个时钟对象:public class Clock private Display h = new Display(24);private Display min = new Display(60);private Display s = new Display(60);public void start () for(;;) s.increase();if(s.getValue() == 0)min.increase();if(min.getValue() == 0)h.increase();}}System.out.printf("%02d:%02d:%02d\n",h.getValue(), min.getValue(),s.getValue());//格式输出}}public static void main(String[] args) Clock clock = new Clock();clock.start();}是数字的、还是模拟指针的呢~~~~~~~~~~~import java.awt.color;import java.util.*;import java.awt.*;import java.applet.*;public class clock extends applet implements runnable thread timer=null; label label; int lastxs=50,lastys=30,lastxm=50,lastym=30,lastxh=50,lastyh=30; public void init()label=new label(" ");setbackground(color.white);add(label); } public void paint(graphics g)int xh,yh,xm,ym,xs,ys,s,m,h,xcenter,ycenter;date rightnow=new date();string today=rightnow.tolocalestring();label.settext(today);s=rightnow.getseconds();m=rightnow.getminutes();h=rightnow.gethours();xcenter=100;ycenter=80;xs=(int)(math.cos(s*3.14f/30-3.14f/2)*45+xcenter);ys=(int)(math.sin(s*3.14f/30-3.14f/2)*45+ycenter);xm=(int)(math.cos(m*3.14f/30-3.14f/2)*45+xcenter);ym=(int)(math.sin(m*3.14f/30-3.14f/2)*45+ycenter);xh=(int)(math.cos((h*30+m*2)*3.14f/180-3.14f/2)*30+xcenter);yh=(int)(math.sin((h*30+m*2)*3.14f/180-3.14f/2)*30+ycenter);g.setfont(new font("timestoman",font.plain,14));g.setcolor(color.orange);g.fill3drect(xcenter-50,ycenter-50,100,100,true);g.setcolor(color.darkgray);g.drawstring("12",xcenter-5,ycenter-37);g.drawstring("3",xcenter+40,ycenter+3);g.drawstring("6",xcenter-3,ycenter+45);g.drawstring("9",xcenter-45,ycenter+3);g.setcolor(color.orange);if(xs!=lastxs||ys!=lastys)g.drawline(xcenter,ycenter,lastxs,lastys);}if(xm!=lastxm||ym!=lastym)g.drawline(xcenter,ycenter-1,lastxm,lastym);g.drawline(xcenter-1,ycenter,lastxm,lastym);}if(xh!=lastxh||yh!=lastyh)g.drawline(xcenter,ycenter-1,lastxh,lastyh);g.drawline(xcenter-1,ycenter,lastxh,lastyh);}g.setcolor(color.red);g.drawline(xcenter,ycenter,xs,ys);g.drawline(xcenter,ycenter-1,xm,ym);g.drawline(xcenter-1,ycenter,xm,ym);g.drawline(xcenter,ycenter-1,xh,yh);g.drawline(xcenter-1,ycenter,xh,yh);lastxs=xs;lastys=ys;lastxm=xm;lastym=ym;lastxh=xh;lastyh=yh; } public void start()if(timer==null)timer=new thread(this);timer.start();} } public void stop()timer=null; } public void run()while(timer!=null)trythread.sleep(1000);}catch(interruptedexception ie)repaint();}timer=null; } public void update(graphics g)paint(g); }}【如何在电脑上编程一个时钟,我想在电脑屏幕上设置一个时钟该怎么做啊】
推荐阅读
- 安卓自拍滤镜,潮人自拍怎么做鬼?尼斯滤镜软件给你个性化滤镜
- 安卓图标圆角规范,点击替换图标7.进入更改图标页面
- 苹果公司的创办人常被戏称为什么,苹果公司创办人被戏称为什么
- 安卓资源文件夹名称,安卓手机文件管理器如何进行操作?
- 安卓手机能把wifi转成ap,为什么需要加便携wifi?
- iphone13与14参数对比,2014款苹果air11寸和13寸选哪一个好
- 安洁科技苹果产业链,苹果主要零件是什么供应商生产的
- 安卓导航键间距大小,全屏导航手机需要注意什么?
- 苹果12正品多少钱,正版iPhone多少钱从实体店能买到的