Skip to content
Snippets Groups Projects
Commit 97868314 authored by Hai HoDac's avatar Hai HoDac
Browse files

Fixed code

parent e11739bf
Branches
No related tags found
No related merge requests found
...@@ -292,9 +292,9 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis ...@@ -292,9 +292,9 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis
if (currentMode == Mode.TEXT){ if (currentMode == Mode.TEXT){
notifyUsingTimer(); notifyUsingTimer();
} }
else { // else {
drawingController.broadcastDrawingUserStopped(client.getUserName()); // drawingController.broadcastDrawingUserStopped(client.getUserName());
} // }
} catch (RemoteException ex) { } catch (RemoteException ex) {
ex.printStackTrace(); ex.printStackTrace();
...@@ -403,7 +403,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis ...@@ -403,7 +403,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis
try { try {
if (currentMode != Mode.TEXT){ if (currentMode != Mode.TEXT){
drawingController.broadcastDraggingDrawing(client.getUserName(), drawing, currentMode.toString(), shapeColor, strokeSize); drawingController.broadcastDraggingDrawing(client.getUserName(), drawing, currentMode.toString(), shapeColor, strokeSize);
drawingController.broadcastDrawingUser(client.getUserName()); // drawingController.broadcastDrawingUser(client.getUserName());
} }
} catch (RemoteException ex) { } catch (RemoteException ex) {
......
...@@ -74,6 +74,12 @@ public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate ...@@ -74,6 +74,12 @@ public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate
g2.setColor(color); g2.setColor(color);
client.getApplicationMain().getPaintGUI().getDrawingArea().repaint(); 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; return true;
} }
...@@ -96,6 +102,15 @@ public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate ...@@ -96,6 +102,15 @@ public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate
break; break;
} }
client.getApplicationMain().getPaintGUI().getDrawingArea().repaint(); 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; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment