http://www.pudn.com/downloads102/sourcecode/java/detail415960.html

2.http://www.pudn.com/downloads132/sourcecode/java/applet/detail560593.html

3.http://www.pudn.com/downloads105/sourcecode/java/applet/game/detail433287.html

4.http://www.pudn.com/downloads140/sourcecode/java/applet/detail604486.html

5.http://www.pudn.com/downloads128/sourcecode/java/applet/detail546090.html

请发到这个邮箱地址 mumasara@126.com
可以追加100分"/>

哪位大虾帮我在pudn程序员开发网下几个java的源程序??急求啊!!

发布时间:2024-05-14 03:13 发布:上海旅游网

问题描述:

请把下载链接放在回答内容里,十分感谢,万分感谢!小弟现在急需代码,谢谢!!
这是代码的链接
1.http://www.pudn.com/downloads102/sourcecode/java/detail415960.html

2.http://www.pudn.com/downloads132/sourcecode/java/applet/detail560593.html

3.http://www.pudn.com/downloads105/sourcecode/java/applet/game/detail433287.html

4.http://www.pudn.com/downloads140/sourcecode/java/applet/detail604486.html

5.http://www.pudn.com/downloads128/sourcecode/java/applet/detail546090.html

请发到这个邮箱地址 mumasara@126.com
可以追加100分

问题解答:

汉,原来是都是钟哟,我直接贴出来吧,
一个java 一个applet
记得追加分哟,嘻嘻
//applet
import java.awt.*;
import java.applet.*;
import java.util.Date; //这是Java中的低级实用工具包,可以处理时间等内容。
public class Applet1 extends Applet implements Runnable //有线程运行接口
{
Date timenow; //Date是一个时间定义与创建函数.
Clock myClock; //用户自定义的类
Thread clockthread=null; //设置一个线程
public void start() //线程开始的类
{
if (clockthread==null) //如果线程为空,则
{
clockthread=new Thread (this); //开始新的线程
clockthread.start(); //开始
}
}
public void stop() //终止线程
{
clockthread.stop(); //终止线程,使它
clockthread=null; //为空
}
public void run() //运行线程
{
while(true) //一个死循环,条件永远都是真的。
{
repaint(); //重新绘制界面
try{Thread.sleep(1000);} //让线程沉睡1000毫秒,也就是一秒钟
catch(InterruptedException e){} //捕获异常(也就是错误)
}
}
public void paint(Graphics g)
{
timenow=new Date(); //新的时间的获得
//获得小时,分钟,秒钟
myClock=new Clock(timenow.getHours (),
timenow.getMinutes (),
timenow.getSeconds ());
g.drawString(timenow.toString(),25,240);//将它打印出来!
myClock.show(g,100,100,100); //使面板显示
}
}
class Clock //用户自定义的类开始,编译后,它单独成为一个CLASS文件
{
Clock(int hrs,int min,int sec) //类函数入口
{
hour=hrs%12; //将原始数据处理,得到小时
minute=min; //将原始数据处理,得到分钟
second=sec; //将原始数据处理,得到小时
}
void show(Graphics g,int cx,int cy,int rad) //重新定义SHOW函数
{
int hrs_len=(int)(rad*0.5), //时针的长度
min_len=(int)(rad*0.6), //分钟的长度
sec_len=(int)(rad*0.9); //秒钟的长度
double theta;
//画出钟面
g.drawOval(cx-rad,cy-rad,rad*2,rad*2);
//画出时针
theta=(double)(hour*60*60+minute*60+second)/43200.0*2.0*Math.PI ;
drawNiddle(g,Color.blue,cx,cy,hrs_len,theta);
//画出分针
theta=(double)(minute*60+second)/3600.0*2.0*Math.PI ;
drawNiddle(g,Color.red,cx,cy,sec_len,theta);
//画出秒针
theta=(double)(second)/60.0*2.0*Math.PI ;
drawNiddle(g,Color.green ,cx,cy,sec_len,theta);
}
private void drawNiddle(Graphics g,Color c,int x,int y,int len,double theta)
{
int ex=(int)(x+len*Math.sin(theta));
int ey=(int)(y-len*Math.cos(theta));
g.setColor (c);
g.drawLine(x,y,ex,ey);
}
int hour,minute,second;
}

//java

import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.text.*;
public class Clock extends JPanel implements Runnable{
private JLabel jl;
private DateFormat df;
public Clock(){
jl=new JLabel();
jl.setHorizontalAlignment(JLabel.CENTER);
df=DateFormat.getDateTimeInstance();
new Thread(this).start();
this.setLayout(new BorderLayout());
this.add(jl,BorderLayout.SOUTH);
}
public void run(){
while(true){
try{
Thread.sleep(1000);
}
catch(InterruptedException ie){
ie.printStackTrace();
}
jl.setText(df.format(new Date()));
repaint();
}

}
public void paintComponent(Graphics g){
super.paintComponent(g);
Calendar cal=Calendar.getInstance();
//�õ���ǰ��ʱ����Ϣ
int hour=cal.get(Calendar.HOUR);
int minute=cal.get(Calendar.MINUTE);
int second=cal.get(Calendar.SECOND);
//�õ���ǰ�����Ĵ�С��Ϣ
int width=this.getWidth();
int height=this.getHeight();
//�ӵ��Ǹ�Բ��ȡ}��֮��С���Ǹ�
int small=width<height?width:height;
int diameter=(int)(small*0.8);
int radius=diameter/2;
//ȷ�����ĵ�
Point center=new Point(width/2,height/2);
//ȷ��ʱ�룬���ӣ�����ij���
int secondLength=(int)(radius*0.8);
int minuteLength=(int)(secondLength*0.8);
int hourLength=(int)(minuteLength*0.8);
//ȷ��ʱ�룬���룬�������һ�����
int secondX=center.x+(int)(secondLength*Math.sin(second*2*Math.PI/60.0));
int secondY=center.y-(int)(secondLength*Math.cos(second*2*Math.PI/60.0));
int minuteX=center.x+(int)(minuteLength*Math.sin(minute*2*Math.PI/60.0));
int minuteY=center.y-(int)(minuteLength*Math.cos(minute*2*Math.PI/60.0));
int hourX=center.x+(int)(hourLength*Math.sin((minute/60.0+hour)*Math.PI/6.0));
int hourY=center.y-(int)(hourLength*Math.cos((minute/60.0+hour)*Math.PI/6.0));
Graphics2D g2d=(Graphics2D)g;
//�����̺Ϳ̶�
g.drawOval(center.x-radius,center.y-radius,diameter,diameter);
for(int i=0;i<60;i++){
int x2=center.x+(int)(radius*Math.sin(i*2*Math.PI/60.0));
int y2=center.y-(int)(radius*Math.cos(i*2*Math.PI/60.0));
if(i%5==0){
int x1=center.x+(int)((secondLength+1)*Math.sin(i*2*Math.PI/60.0));
int y1=center.y-(int)((secondLength+1)*Math.cos(i*2*Math.PI/60));
g.drawString(i==0?"12":String.valueOf(i/5),x1,y1); // << attention here
g2d.setStroke(new BasicStroke(2.5f));
g2d.drawLine(x1,y1,x2,y2);
}
else{
int x1=center.x+(int)((secondLength+10)*Math.sin(i*2*Math.PI/60.0));
int y1=center.y-(int)((secondLength+10)*Math.cos(i*2*Math.PI/60));
g2d.setStroke(new BasicStroke(0.8f));
g2d.drawLine(x1,y1,x2,y2);
}
}
//��ʱ�룬���룬����

g2d.setColor(Color.RED);
g2d.setStroke(new BasicStroke(3.0f));
g2d.drawLine(center.x,center.y,hourX,hourY);
g2d.setColor(Color.BLUE);
g2d.setStroke(new BasicStroke(1.5f));
g2d.drawLine(center.x,center.y,minuteX,minuteY);
g2d.setColor(Color.MAGENTA);
g2d.setStroke(new BasicStroke(1.0f));
g2d.drawLine(center.x,center.y,secondX,secondY);

}
public static void main(String args[]){
JFrame jf=new JFrame("ʱ��");
jf.getContentPane().add(new Clock(),BorderLayout.CENTER);
jf.setBounds(300,300,300,300);
jf.setVisible(true);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

}

你给我分吗?

热点新闻