首页>代码>纯java swing开发时钟>/bird/src/com/xx/watch/SZ.java
package com.xx.watch;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

/**
 *SZ.java
 *com.xx.watch
 *工程:bird
 *功能:TODO
 *author  date time
 *李星星 2014-2-27 下午5:41:05
 *Email:hai5253@163.com
 *copytight (C) 2014 ,INI All Rights Reserved.
 */
public class SZ {
	int x;
	int y;
	int width;
	int height;
	double agnle=0;
	BufferedImage image;
	public SZ(int x,int y,double s) throws IOException{
		image = ImageIO.read(getClass().getResource("sz.png"));
		this.height = image.getHeight();
		this.width = image.getWidth();
		this.x = x/2-width/2;
		this.y = y/2-height+8;
		if(s>12){
			s = s-12;
		}
		this.agnle = (Math.PI/6)*s;
	}
	public void step(){
		agnle= agnle+(Math.PI/108000);
		if(agnle>(2*Math.PI))agnle=0;
	}
	public synchronized void paint(Graphics g){
		Graphics2D g2 = (Graphics2D)g;
		g2.rotate(agnle, this.x+width/2, this.y+height-8);
		g2.drawImage(image, x, y,null);
		g2.rotate(-agnle, this.x+width/2, this.y+height-8);
	}
}
最近下载更多
Willson88888  LV3 2022年12月7日
飘逸人  LV4 2022年11月17日
mannka  LV2 2022年6月28日
Demo1111  LV30 2021年12月12日
最代码-宋家辉  LV61 2021年11月30日
woaini001987  LV1 2020年11月16日
谷凤宇  LV10 2020年5月29日
wei112233  LV15 2020年4月2日
15966848095  LV22 2020年1月12日
y1214435276  LV9 2019年9月25日
最近浏览更多
drawing 2023年11月6日
暂无贡献等级
qq1434100519  LV1 2023年11月1日
2385649653  LV7 2023年6月25日
aweixianng 2023年6月24日
暂无贡献等级
WZXYYS 2023年6月5日
暂无贡献等级
SILKYYY 2023年5月25日
暂无贡献等级
111168 2023年5月21日
暂无贡献等级
微信网友_6425728903319552  LV1 2023年4月9日
Willson88888  LV3 2022年12月7日
飘逸人  LV4 2022年11月17日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友