import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.rmi.*; import java.net.*; public class ExempleAppletRmiMaster extends Applet implements ActionListener { private int p = 0 ; private String objet; private ExempleAppletRmiInterface b; public ExempleAppletRmiMaster() { setLayout(new BorderLayout()); Button b = new Button("Go"); add("South",b); b.addActionListener(this); setBackground(Color.white); b.setBackground(Color.white); } public void init() { URL url = this.getDocumentBase(); objet = "rmi://"+url.getHost()+"/objet" ; try { b =(ExempleAppletRmiInterface) Naming.lookup(objet); } catch( RemoteException e) { } catch( NotBoundException e) { } catch( MalformedURLException e) { } ; } public void paint(Graphics g) { g.drawRect(25*p+2,3,20,120) ; } public void actionPerformed(ActionEvent e) { p = (p+1) % 10 ; try { b.position(p); } catch( RemoteException re) { } ; repaint(); } }