Skip to content
Snippets Groups Projects
Select Git revision
  • 7854dccb3855ff558a9a1462d878ebc53a23fac2
  • master default protected
  • hai
  • isaac
  • CheHao
  • Eldar
  • mpriymak
  • master-before-merging-with-hai
  • master-before-merging-with-isaac
  • rmi-working-before-merging-with-isaac
  • all-code-merged-by-hai-v1
11 results

ClientCanvas.java

Blame
  • ClientCanvas.java 1.28 KiB
    package client;
    
    import GUI.DrawingArea;
    import remote.IClientController;
    import remote.IDrawingController;
    import server.User;
    
    import java.rmi.registry.LocateRegistry;
    import java.rmi.registry.Registry;
    import java.util.ArrayList;
    import java.util.Observable;
    
    public class ClientCanvas extends Observable {
    
        private static int id=1;
        private IClientController clientController;
        private IDrawingController drawingController;
        private ArrayList<User> users;
        private DrawingArea drawing;
    
        public ClientCanvas() {
            users = new ArrayList<>();
            drawing = new DrawingArea();
            try {
                //Connect to the rmiregistry that is running on localhost
                Registry registry = LocateRegistry.getRegistry("localhost");
    
                //Retrieve the stub/proxy for the remote math object from the registry
                this.drawingController = (IDrawingController) registry.lookup("DrawingController");
                this.clientController = (IClientController) registry.lookup("ClientController");
    
                //Call methods on the remote object as if it was a local object
                System.out.println("Client: calling remote methods");
    
    //            clientController.addClient(id);
    
            }catch(Exception e) {
                e.printStackTrace();
            }
        }
    
    
    
    }