Skip to content
Snippets Groups Projects
Commit 6f42314c authored by Pedroza Aguirre Isaac's avatar Pedroza Aguirre Isaac
Browse files
parents f889c4da 8c95a987
Branches
No related tags found
No related merge requests found
...@@ -209,7 +209,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis ...@@ -209,7 +209,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis
g2.setFont(new Font("TimesRoman", Font.PLAIN, textSize)); g2.setFont(new Font("TimesRoman", Font.PLAIN, textSize));
g2.drawString(textString, startPoint.x, startPoint.y); g2.drawString(textString, startPoint.x, startPoint.y);
try { try {
client.getDrawingController().broadcastText(client.getUserName(), textString, g2.getFont(), startPoint); client.getDrawingController().broadcastText(client.getUserName(), textString, g2.getFont(), shapeColor, startPoint);
} catch (RemoteException ex) { } catch (RemoteException ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
......
...@@ -15,7 +15,7 @@ import java.rmi.RemoteException; ...@@ -15,7 +15,7 @@ import java.rmi.RemoteException;
*/ */
public interface IDrawingController extends Remote { public interface IDrawingController extends Remote {
boolean broadcastText(String fromClient, String text, Font font, Point startPoint) throws RemoteException; boolean broadcastText(String fromClient, String text, Font font, Color color, Point startPoint) throws RemoteException;
boolean broadcastDrawing(String fromClient, Shape drawing, String mode, Color color, int strokeSize) throws RemoteException; boolean broadcastDrawing(String fromClient, Shape drawing, String mode, Color color, int strokeSize) throws RemoteException;
boolean broadcastDraggingDrawing(String fromClient, Shape drawing, String mode, Color color, int strokeSize) throws RemoteException; boolean broadcastDraggingDrawing(String fromClient, Shape drawing, String mode, Color color, int strokeSize) throws RemoteException;
boolean broadcastClearCanvas(String fromClient) throws RemoteException; boolean broadcastClearCanvas(String fromClient) throws RemoteException;
......
...@@ -3,6 +3,7 @@ package server; ...@@ -3,6 +3,7 @@ package server;
import remote.IDrawingController; import remote.IDrawingController;
import remote.IDrawingUpdate; import remote.IDrawingUpdate;
import javax.imageio.ImageIO;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.*; import java.io.*;
...@@ -29,13 +30,13 @@ public class DrawingController extends UnicastRemoteObject implements IDrawingCo ...@@ -29,13 +30,13 @@ public class DrawingController extends UnicastRemoteObject implements IDrawingCo
} }
@Override @Override
public boolean broadcastText(String fromClient, String text, Font font, Point startPoint) throws RemoteException { public boolean broadcastText(String fromClient, String text, Font font, Color color, Point startPoint) throws RemoteException {
System.out.print("Broadcasting drawing to everyone..."); System.out.print("Broadcasting drawing to everyone...");
g2 = (Graphics2D) bufferedImage.getGraphics(); g2 = (Graphics2D) bufferedImage.getGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setFont(font); g2.setFont(font);
// g2.setPaint(Color.BLACK); g2.setPaint(color);
g2.drawString(text, startPoint.x, startPoint.y); g2.drawString(text, startPoint.x, startPoint.y);
g2 = (Graphics2D) bufferedImage.getGraphics(); g2 = (Graphics2D) bufferedImage.getGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
......
...@@ -60,6 +60,16 @@ public class Server ...@@ -60,6 +60,16 @@ public class Server
public void run() throws RemoteException public void run() throws RemoteException
{ {
String serverIP = "";
try {
InetAddress inetAddress = InetAddress.getLocalHost();
serverIP = inetAddress.getHostAddress();
} catch (Exception e) {
e.printStackTrace();
}
System.setProperty("java.rmi.server.hostname", serverIP);
LocateRegistry.createRegistry(1099); LocateRegistry.createRegistry(1099);
Registry registry = LocateRegistry.getRegistry(); Registry registry = LocateRegistry.getRegistry();
// if (System.getSecurityManager() == null) { // if (System.getSecurityManager() == null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment