Topic: 紧急求救:关于APPLET

  Print this page

1.紧急求救:关于APPLET Copy to clipboard
Posted by: cjsdn_an
Posted on: 2004-10-25 09:40

1.creat a basic web page with a static image
2.replace the image for an applet which displays the image

这个怎么实现呀,现在的代码只能实现用APPLET显示出一个图片.怎么置换呀,请各位大侠帮忙解决.
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;

public class test2 extends Applet{
  Image img ;
  
  public void init(){
    img = getImage(getCodeBase(),"ima_1.gif");
  }
  public void paint(Graphics g){
      g.drawImage(img,20,20,this);
      g.setColor(Color.blue);
      g.drawString(" lovely!",300,20);
      g.drawString("jack and rose!",300,80);
  }
}

2.Re:紧急求救:关于APPLET [Re: cjsdn_an] Copy to clipboard
Posted by: kavinwang
Posted on: 2004-10-25 10:10

img = getImage(getCodeBase(),"other.gif");
repaint();

3.Re:紧急求救:关于APPLET [Re: cjsdn_an] Copy to clipboard
Posted by: cjsdn_an
Posted on: 2004-10-25 10:26

谢谢指点,不过这两句话是在什么位置插入.

4.Re:紧急求救:关于APPLET [Re: cjsdn_an] Copy to clipboard
Posted by: kavinwang
Posted on: 2004-10-25 11:51

问题是你想怎样替换,如果是动态的,可以生成一个线程,在线程中进行更新,如果只是一个按钮,在按钮的事件中进行更新。
如果定时更新,也可生成一个timer进行更新


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923