import java.applet.Applet ; import java.net.URL ; import java.net.MalformedURLException ; import java.awt.Graphics ; import java.awt.Image ; import java.awt.event.* ; import java.awt.* ; public class AppletURL1 extends Applet implements ActionListener { private Image i = null ; private Button ok ; private String base ; public void init() { setLayout(new BorderLayout()); add(ok = new Button("Telechargement"),BorderLayout.SOUTH); ok.addActionListener(this) ; URL url = getCodeBase(); base = url.toString(); System.out.println(base); } public void paint(Graphics g) { if ( i != null ) g.drawImage(i,0,0,this) ; } public void actionPerformed(ActionEvent e) { URL u ; try { String adresse = base+"r1.gif" ; u = new URL(adresse) ; i = getImage(u) ; repaint() ; } catch (MalformedURLException mue) { } } }