package package002;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;

public class Demo002 Rotary clock extends JFrame{
TranPanel panel; public static void main(String[] args) { Demo002 Rotary clock frame =
new Demo002 Rotary clock (); frame.setVisible(true); } public Demo002 Rotary clock () {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(300, 5, 1000, 1030);
panel=new TranPanel(); setContentPane(panel); new Thread(panel).start(); }
}

class TranPanel extends JPanel implements Runnable{
int h=11; int min=59; int miao=56; public void paint(Graphics g) {
g.fillOval(500-12, 500-12, 14, 14); dynamicClock(g,h,min,miao); } public void
dynamicClock(Graphics g,int h,int min,int miao) {
drawtime(g," second ",60,860,6,miao);// paint brush Hour minute second Number of cycles Painted x coordinate Rotation angle
drawtime(g," branch ",60,740,6,min); drawtime(g," Time ",24,620,15,h); } public void
drawtime(Graphics g,String time,int num,int drawx,int angle,int startnum) {
Graphics2D g2 = (Graphics2D)g ; for(int i=0+startnum;i<=num+startnum;i++) {
Image img = new ImageIcon("E:\\"+time+"\\"+i%num+time+".jpg").getImage();
g2.translate(500,485); g2.rotate(Math.toRadians(angle));
g2.translate(-500,-485); g2.translate(drawx,485); g2.drawImage(img,0,0,this) ;
g2.translate(-drawx,-485); } } @Override public void run() { while(true) { try
{ Thread.sleep(1000); miao+=1; if(miao>=60) { miao=0; min+=1; } if(min>=60) {
min=0; h+=1; } if(h>=24) { h=1; }
System.out.println(" current time :"+h+" Time "+min+" branch "+miao+" second "); repaint(); } catch
(InterruptedException e) { e.printStackTrace(); } } }
}

Technology
©2019-2020 Toolsou All rights reserved,
mysql Recursively finds all child nodes of the parent class LED Scrolling text mybatis Return result mapping of series ( Essence )2020 year 6 month 26 day C# Class library model PageInput[RK3399][Android7.1] Learning notes DRM Driver development ( introduce )( Essence )2020 year 8 month 13 day C# Basic knowledge windform Realize two color sphere Theory and formula derivation of univariate linear regression and multiple linear regression Java Thread of Sleep() Summary of usage Front end to background 5 Summary of different ways ElementUI In the select Of label value