高分悬赏java编程题!!!!!!!!!!

请高手赐教!!!!!!!
100 分 案例2
编写Java applet 小程序,
 以影像为背景;
 中间为顺序切换的相册,单击鼠标,切换到下一张相片;
 显示表示日期和时间的字符串,字符串每秒更新一次;
 添加一个由字符串(如“成功学院”)和图形组合成的滚动加平移的动画单元
题目要求以影像为背景!做出来可以高分追加!要多少分给多少分!题目要求有不明白的地方QQ联系:403122830!谢谢了。

import java.applet.*;
import java.awt.Graphics;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.URL;
import java.text.SimpleDateFormat;
import javax.swing.*;

public class MyLabel extends Applet{
private ImageIcon bgImage;
private JLabel Label;
private JLabel label_time;
private JLabel label_run;
private ImageIcon []image;
private static int imageNum;
private boolean running;
private ShowTime showTime;
public void init() {
label_time = new JLabel();
label_run = new JLabel("哈哈哈哈哈....");
Label = new JLabel();
showTime = new ShowTime();
image = new ImageIcon[3];
try {

bgImage = new ImageIcon
(new URL(this.getClass().getResource("")+"bgImage.jpg"));
for (int i = 0; i < 3; i++) {
image[i] = new ImageIcon
(new URL(this.getClass().getResource("")+"image"+i+".jpg"));
}
}
catch (Exception e) {
System.out.println("Load image failed!");
return;
}
this.setSize(Toolkit.getDefaultToolkit().getScreenSize());
imageNum = 0;
setLayout(null);
Label.setSize(300, 300);
Label.setLocation(0, 0);
label_time.setSize(200, 30);
label_time.setLocation(100, 50);
label_run.setSize(200, 50);
label_run.setLocation(0, 400);
add(Label);
add(label_time);
add(label_run);
add(new JTextField(10));
running = true;
showTime.start();
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
imageNum++;
repaint(); // 调用paint( )方法
}
});
}

public void update(Graphics g){
paint(g);
}

public void start(){

this.setVisible(true);
}

public void stop() {
running = false;
}

public void paint(Graphics g) {
/* Draw the line */
g.clearRect(0, 0, getSize().width, getSize().height);
bgImage.paintIcon(this, g, 0, 0);
g.drawImage(image[imageNum%3].getImage(), getSize().width/2 - image[imageNum%3].getIconWidth()/2,
100, image[imageNum%3].getIconWidth(), image[imageNum%3].getIconHeight(), this);
paintComponents(g);
}

public class ShowTime extends Thread{
public void run() {
// TODO Auto-generated method stub
int count = 0;
while(running){
count++;
if(count%10 == 0) {
SimpleDateFormat tempDate = new SimpleDateFormat("yyyy-MM-dd" + " " + "hh:mm:ss");
String datetime = tempDate.format(new java.util.Date());
label_time.setText(datetime);
}
label_run.setLocation((10*count)%1024, 400);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}

}
温馨提示:内容为网友见解,仅供参考
第1个回答  2009-06-11
现在会java applet不多 关注一下
第2个回答  2009-06-11
影像为背景还是图像为背景?要是图像我可以做一个 ,影像麻烦大了
相似回答
大家正在搜