diff --git a/src/GUI/DrawingArea.java b/src/GUI/DrawingArea.java index 6282dfd62a8d890332f3bc3ca669c8523e4835ac..5c4b24dc7fc6c749176639fff9cc6495044df3e4 100644 --- a/src/GUI/DrawingArea.java +++ b/src/GUI/DrawingArea.java @@ -292,9 +292,9 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis if (currentMode == Mode.TEXT){ notifyUsingTimer(); } - else { - drawingController.broadcastDrawingUserStopped(client.getUserName()); - } +// else { +// drawingController.broadcastDrawingUserStopped(client.getUserName()); +// } } catch (RemoteException ex) { ex.printStackTrace(); @@ -403,7 +403,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis try { if (currentMode != Mode.TEXT){ drawingController.broadcastDraggingDrawing(client.getUserName(), drawing, currentMode.toString(), shapeColor, strokeSize); - drawingController.broadcastDrawingUser(client.getUserName()); +// drawingController.broadcastDrawingUser(client.getUserName()); } } catch (RemoteException ex) { diff --git a/src/client/DrawingUpdate.java b/src/client/DrawingUpdate.java index 60ea6688da2a1f8f336a70813f61aa45dc9c472d..9f526a798491bde6d896c09f3c257ea68b8d02e8 100644 --- a/src/client/DrawingUpdate.java +++ b/src/client/DrawingUpdate.java @@ -74,6 +74,12 @@ public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate g2.setColor(color); client.getApplicationMain().getPaintGUI().getDrawingArea().repaint(); + DefaultListModel temp = client.getApplicationMain().getChatScreen().getAllUserModel(); + int elementIndex = -1; + if(temp.contains(fromClient)){ + elementIndex = temp.indexOf(fromClient); + temp.remove(elementIndex); + } return true; } @@ -96,6 +102,15 @@ public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate break; } client.getApplicationMain().getPaintGUI().getDrawingArea().repaint(); + + DefaultListModel temp = client.getApplicationMain().getChatScreen().getAllUserModel(); + if(temp.contains(fromClient)){ + System.out.println("Already in the list"); + } + else { + temp.addElement(fromClient); + } + return true; }