Skip to content
Snippets Groups Projects
Select Git revision
2 results Searching

__init__.py

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();
            }
        }
    
    
    
    }