diff --git a/.idea/$PRODUCT_WORKSPACE_FILE$ b/.idea/$PRODUCT_WORKSPACE_FILE$
new file mode 100644
index 0000000000000000000000000000000000000000..3733e0d369c0331583e53353e77299dc56783aab
--- /dev/null
+++ b/.idea/$PRODUCT_WORKSPACE_FILE$
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="masterDetails">
+ <states>
+ <state key="ProjectJDKs.UI">
+ <settings>
+ <last-edited>1.8</last-edited>
+ <splitter-proportions>
+ <option name="proportions">
+ <list>
+ <option value="0.2" />
+ </list>
+ </option>
+ </splitter-proportions>
+ </settings>
+ </state>
+ </states>
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..5c98b428844d9f7d529e2b6fb918d15bf072f3df
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,2 @@
+# Default ignored files
+/workspace.xml
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d259417a7bc4a8a687db5011b092dfb2c2caf0a5
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_12" default="false" project-jdk-name="12" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1fe4435f739a457406c6c8482d6bbcec0854e0aa
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/infinitymonkeys.iml" filepath="$PROJECT_DIR$/infinitymonkeys.iml" />
+ </modules>
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e96534fb27b68192f27f985d3879e173ec77adb8
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="Git" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/META-INF/application.xml b/META-INF/application.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6d17810e0e6f2851d90e76d845805c963ab7773e
--- /dev/null
+++ b/META-INF/application.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_8.xsd"
+ version="8">
+
+</application>
diff --git a/comp90015-dsass2-infinitymonkeys-remaster.iml b/comp90015-dsass2-infinitymonkeys-remaster.iml
new file mode 100644
index 0000000000000000000000000000000000000000..7152d058eeaf78185b07d439256d64bb8f90cd22
--- /dev/null
+++ b/comp90015-dsass2-infinitymonkeys-remaster.iml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="javaeeApplication" name="javaEEApplication">
+ <configuration>
+ <descriptors>
+ <deploymentDescriptor name="application.xml" url="file://$MODULE_DIR$/META-INF/application.xml" />
+ </descriptors>
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
\ No newline at end of file
diff --git a/comp90015_assignment2.iml b/comp90015_assignment2.iml
new file mode 100644
index 0000000000000000000000000000000000000000..c90834f2d607afe55e6104d8aa2cdfffb713f688
--- /dev/null
+++ b/comp90015_assignment2.iml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
\ No newline at end of file
diff --git a/infinitymonkeys.iml b/infinitymonkeys.iml
new file mode 100644
index 0000000000000000000000000000000000000000..7152d058eeaf78185b07d439256d64bb8f90cd22
--- /dev/null
+++ b/infinitymonkeys.iml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="javaeeApplication" name="javaEEApplication">
+ <configuration>
+ <descriptors>
+ <deploymentDescriptor name="application.xml" url="file://$MODULE_DIR$/META-INF/application.xml" />
+ </descriptors>
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
\ No newline at end of file
diff --git a/src.zip b/src.zip
new file mode 100644
index 0000000000000000000000000000000000000000..d037531c7c7e5a2934c2e6521fdab3171a018182
Binary files /dev/null and b/src.zip differ
diff --git a/src/GUI/ApplicationMain.java b/src/GUI/ApplicationMain.java
new file mode 100644
index 0000000000000000000000000000000000000000..37ef1ee80a5449e798a3827fc063fa130431a9bd
--- /dev/null
+++ b/src/GUI/ApplicationMain.java
@@ -0,0 +1,80 @@
+package GUI;
+
+import client.Client;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.rmi.RemoteException;
+
+public class ApplicationMain extends JPanel {
+ Client client;
+ ChatScreen chatScreen;
+ PaintGUI paintGUI;
+ JFrame frame;
+
+ public ChatScreen getChatScreen() { return chatScreen; }
+
+ public PaintGUI getPaintGUI() { return paintGUI; }
+
+ public JFrame getFrame() {
+ return frame;
+ }
+
+ public ApplicationMain(Client client) {
+ this.client = client;
+ this.chatScreen = new ChatScreen(client);
+ this.paintGUI = new PaintGUI(client);
+ }
+
+ public void createAndShowGUI()
+ {
+ frame = new JFrame("Application Main");
+ JFrame.setDefaultLookAndFeelDecorated(true);
+ Container content = frame.getContentPane();
+ content.setLayout(new BorderLayout());
+ content.add(paintGUI.getGlobal(), BorderLayout.WEST);
+ content.add(chatScreen.panel2, BorderLayout.EAST);
+ chatScreen.setUserName(client.getUserName());
+
+ SwingUtilities.getRootPane(chatScreen.getSendButton()).setDefaultButton(chatScreen.getSendButton());
+ frame.addWindowListener(new WindowAdapter()
+ {
+ @Override
+ public void windowClosing(WindowEvent arg0)
+ {
+ int reply = JOptionPane.showConfirmDialog(null,
+ "Are you sure you want to quit the session?",
+ "Shut down session", JOptionPane.YES_NO_OPTION);
+
+ if( reply == JOptionPane.YES_OPTION )
+ {
+ try
+ {
+ client.getClientController().quit(client.getUserName());
+ }
+ catch (RemoteException e)
+ {
+ StartScreen.showErrorMessage("Error in quitting the server");
+ //e.printStackTrace();
+ }
+
+ System.exit(0);
+ }
+
+ if( reply == JOptionPane.NO_OPTION )
+ {
+ //do nothing
+ }
+ }
+ });
+
+ frame.setSize(1200, 700);
+ frame.setLocationRelativeTo( null );
+ frame.setResizable(false);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setVisible(true);
+ }
+}
diff --git a/src/GUI/ChatScreen.form b/src/GUI/ChatScreen.form
new file mode 100644
index 0000000000000000000000000000000000000000..baeed115748181b31d550c0aacfc5dc6db17fe1e
--- /dev/null
+++ b/src/GUI/ChatScreen.form
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="GUI.ChatScreen">
+ <grid id="27dc6" binding="panel2" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="1200" height="1200"/>
+ </constraints>
+ <properties>
+ <maximumSize width="-1" height="-1"/>
+ <minimumSize width="-1" height="-1"/>
+ <preferredSize width="700" height="600"/>
+ </properties>
+ <border type="none"/>
+ <children>
+ <grid id="b37e3" binding="othersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <grid id="bad73" binding="myAreaPanel" layout-manager="GridLayoutManager" row-count="12" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none" title="My Area"/>
+ <children>
+ <component id="a35da" class="javax.swing.JLabel" binding="managersNameLabel">
+ <constraints>
+ <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <font size="14" style="1"/>
+ <text value="Manager's Name:"/>
+ </properties>
+ </component>
+ <vspacer id="38e19">
+ <constraints>
+ <grid row="10" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="98bbe" class="javax.swing.JLabel" binding="yourNameLabel">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <font size="14" style="1"/>
+ <text value="Your Name:"/>
+ </properties>
+ </component>
+ <component id="33d66" class="javax.swing.JLabel" binding="yourNameDisplay">
+ <constraints>
+ <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Here goes User's Name"/>
+ </properties>
+ </component>
+ <grid id="4212" binding="managersPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <grid row="6" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none" title="Manager's Tools"/>
+ <children>
+ <component id="b7068" class="javax.swing.JComboBox" binding="userSelectComboBox">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <model/>
+ </properties>
+ </component>
+ <vspacer id="aae38">
+ <constraints>
+ <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="be5e9" class="javax.swing.JButton" binding="kickOutButton" default-binding="true">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Kick Out"/>
+ </properties>
+ </component>
+ <component id="1336c" class="javax.swing.JButton" binding="promoteToManagerButton" default-binding="true">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Promote to Manager"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+ <component id="51b56" class="javax.swing.JLabel" binding="managersNameDisplay">
+ <constraints>
+ <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Here goes Admin's Name"/>
+ </properties>
+ </component>
+ <vspacer id="e9e96">
+ <constraints>
+ <grid row="11" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="deaed" class="javax.swing.JButton" binding="exitThisRoomButton" default-binding="true">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Exit This Room"/>
+ </properties>
+ </component>
+ <component id="bd8ec" class="javax.swing.JButton" binding="quitButton">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Quit Program"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+ <grid id="5d886" binding="chatPanel" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <grid row="0" column="0" row-span="2" col-span="1" vsize-policy="7" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none" title="Chat Area"/>
+ <children>
+ <component id="6a928" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Your Message"/>
+ </properties>
+ </component>
+ <component id="9e940" class="javax.swing.JButton" binding="sendButton">
+ <constraints>
+ <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Send"/>
+ </properties>
+ </component>
+ <scrollpane id="ec60d">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="c55f3" class="javax.swing.JTextArea" binding="chatDisplayBox">
+ <constraints/>
+ <properties>
+ <editable value="true"/>
+ <lineWrap value="true"/>
+ </properties>
+ </component>
+ </children>
+ </scrollpane>
+ <component id="2b67f" class="javax.swing.JTextField" binding="chatInputBox">
+ <constraints>
+ <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <preferred-size width="150" height="-1"/>
+ </grid>
+ </constraints>
+ <properties/>
+ </component>
+ <component id="df8f1" class="javax.swing.JLabel" binding="sendMessageToLabel">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Send Message To:"/>
+ </properties>
+ </component>
+ <component id="cc35d" class="javax.swing.JComboBox" binding="sendMessageToComboBox">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ </component>
+ </children>
+ </grid>
+ </children>
+ </grid>
+ </children>
+ </grid>
+</form>
diff --git a/src/GUI/ChatScreen.java~origin_master b/src/GUI/ChatScreen.java~origin_master
new file mode 100644
index 0000000000000000000000000000000000000000..513546bd559cbf581e193c62096faeeb55dfde23
--- /dev/null
+++ b/src/GUI/ChatScreen.java~origin_master
@@ -0,0 +1,118 @@
+package GUI;
+
+import client.Client;
+import remote.IChatController;
+import remote.IClientController;
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.rmi.RemoteException;
+
+public class ChatScreen {
+
+ public JPanel panel2;
+
+ private JButton sendButton;
+
+ // private JPanel drawingPanel;
+ private JPanel othersPanel;
+ private JComboBox sendMessageToComboBox;
+ private JTextArea chatDisplayBox;
+ private JComboBox userSelectComboBox;
+ private JButton kickOutButton;
+ private JButton promoteToManagerButton;
+ private JTextField chatInputBox;
+ private JLabel sendMessageToLabel;
+ private JLabel managersNameLabel;
+ private JLabel yourNameLabel;
+ private JLabel yourNameDisplay;
+ private JLabel managersNameDisplay;
+ private JPanel myAreaPanel;
+ private JPanel managersPanel;
+ private JPanel chatPanel;
+ private JButton exitThisRoomButton;
+ private JButton quitButton;
+ private JFrame frame;
+ public Client getClient() {
+ return client;
+ }
+
+ public Client client;
+
+
+ public ChatScreen(Client client)
+ {
+ this.client = client;
+ yourNameDisplay.setText(client.getUserName());
+// drawingPanel = new PaintGUI(client);
+// SwingUtilities.getRootPane(sendButton).setDefaultButton(sendButton);
+ }
+
+
+ public JButton getSendButton() {
+ return sendButton;
+ }
+
+
+ public JTextArea getChatDisplayBox() {
+ return chatDisplayBox;
+ }
+
+ public JComboBox getSendMessageToComboBox()
+ {
+ return sendMessageToComboBox;
+ }
+
+// public JPanel getDrawingPanel() {
+// return drawingPanel;
+// }
+
+
+
+ ActionListener actionListener = new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getSource() == sendButton)
+ {
+ String message = chatInputBox.getText();
+ chatInputBox.setText("");
+ IChatController chatController = client.getChatController();
+ try
+ {
+ System.out.println("Send button pressed");
+
+ String toUser = sendMessageToComboBox.getSelectedItem().toString();
+
+ if( toUser.equals("All") )
+ {
+ chatController.broadcastMessage(client.getUserName(), message);
+ }
+ else
+ {
+ chatController.sendPrivateMessage(client.getUserName(), toUser, message);
+ }
+ }
+ catch (RemoteException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ else if (e.getSource() == exitThisRoomButton)
+ {
+ IClientController clientController = client.getClientController();
+ try
+ {
+ System.out.println("Exit room button pressed");
+ clientController.quit(client.getUserName());
+ System.exit(0);
+ }
+ catch (RemoteException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ };
+}
diff --git a/src/GUI/DrawingArea.java b/src/GUI/DrawingArea.java
new file mode 100644
index 0000000000000000000000000000000000000000..21069490ac09b3a85c3eb35b876440ee928f206a
--- /dev/null
+++ b/src/GUI/DrawingArea.java
@@ -0,0 +1,374 @@
+package GUI;
+
+import client.Client;
+import remote.IDrawingController;
+
+import javax.imageio.ImageIO;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.Line2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RectangularShape;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.rmi.RemoteException;
+
+public class DrawingArea extends JPanel implements MouseMotionListener, MouseListener {
+
+
+
+ /// enum for all different mode ///
+ enum Mode { FREEHAND, LINE, CIRCLE, RECTANGLE, OVAL, ERASE }
+
+ /// Canvas size parameter ///
+ private final static int AREA_WIDTH = 600;
+ private final static int AREA_HEIGHT = 620;
+
+ /// Shape to be drawn on the canvas ///
+ private Client client;
+
+ private Shape drawing;
+
+ private Point startPoint;
+ private Point previousPoint;
+
+ private Point currentPoint;
+ /// Default mode and color ///
+ private Color shapeColor;// = new Color(0, 0, 0);
+
+ private Mode currentMode;// = Mode.FREEHAND;
+ /// Create a empty canvas ///
+ private BufferedImage image;// = new BufferedImage(AREA_WIDTH, AREA_HEIGHT, BufferedImage.TYPE_INT_ARGB);
+
+ /// Drawing tool
+ private Graphics2D g2;// = (Graphics2D) image.getGraphics();
+
+
+ public DrawingArea(Client client) {
+ this.client = client;
+ setBackground(Color.WHITE); // Set Background color
+ setDoubleBuffered(false); // Non-buffered drawing
+ image = new BufferedImage(AREA_WIDTH, AREA_HEIGHT, BufferedImage.TYPE_INT_ARGB);
+ g2 = (Graphics2D) image.getGraphics();
+ /// Antialiasing the graphic for smoothness ///
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ shapeColor = new Color(0, 0, 0);
+ currentMode = Mode.FREEHAND;
+ drawing = null;
+ addMouseListener(this);
+ addMouseMotionListener(this);
+ }
+
+
+ public Shape getDrawing() {
+ return drawing;
+ }
+
+ public void setDrawing(Shape drawing) {
+ this.drawing = drawing;
+ }
+
+
+ @Override
+ public Dimension getPreferredSize()
+ {
+ return isPreferredSizeSet() ?
+ super.getPreferredSize() : new Dimension(AREA_WIDTH, AREA_HEIGHT);
+ }
+
+/// Create a white image to clear previous drawing ///
+ public void clear() {
+
+ image = new BufferedImage(AREA_WIDTH, AREA_HEIGHT, BufferedImage.TYPE_INT_ARGB);
+ g2 = (Graphics2D) image.getGraphics();
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ repaint();
+
+ }
+
+ @Override
+ protected void paintComponent(Graphics g) {
+ super.paintComponent(g);
+
+/// Draw the whole image on JPanel ///
+ if (image != null) {
+ g.drawImage(image, 0, 0, null);
+ }
+
+/// Draw temporary shape ///
+ if (drawing != null) {
+ Graphics2D g2 = (Graphics2D) g;
+
+/// Eraser has no border color ///
+ Color borderColor = currentMode != Mode.ERASE ? shapeColor : Color.WHITE;
+ g2.setColor(borderColor);
+ g2.draw(drawing);
+ IDrawingController drawingController = client.getDrawingController();
+ try {
+ drawingController.broadcastDrawing(client.getUserName(), drawing);
+ } catch (RemoteException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+/// File manipulations (PNG only) ///
+ public void saveFile() {
+ try {
+ ImageIO.write(image, "PNG", new File("Saved_White_Board.png"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void saveAsFile(File file) {
+ try {
+ ImageIO.write(image, "PNG", file);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void openFile(File file) {
+ try {
+ image = ImageIO.read(file);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ repaint();
+ }
+
+/// Drawing mode setters ///
+
+ public void setModeFreehand() {
+ currentMode = Mode.FREEHAND;
+ }
+
+ public void setModeLine() {
+ currentMode = Mode.LINE;
+ }
+
+ public void setModeCircle() {
+ currentMode = Mode.CIRCLE;
+ }
+
+ public void setModeRectangle() {
+ currentMode = Mode.RECTANGLE;
+ }
+
+ public void setModeOval() {
+ currentMode = Mode.OVAL;
+ }
+
+ public void setModeErase() {
+ currentMode = Mode.ERASE;
+ }
+
+/// Drawing color setters ///
+
+ public void setColorAqua() {
+ shapeColor = new Color(0,255, 255);
+ }
+
+ public void setColorBlack() {
+ shapeColor = new Color(0, 0, 0);
+ }
+
+ public void setColorBlue() {
+ shapeColor = new Color(0, 0, 255);
+ }
+
+ public void setColorFuchsia() {
+ shapeColor = new Color(255, 0, 255);
+ }
+
+ public void setColorGray() {
+ shapeColor = new Color(128, 128, 128);
+ }
+
+ public void setColorGreen() {
+ shapeColor = new Color(0, 128, 0);
+ }
+
+ public void setColorLime() {
+ shapeColor = new Color(0, 255, 0);
+ }
+
+ public void setColorMaroon() {
+ shapeColor = new Color(128,0, 0);
+ }
+
+ public void setColorNavy() {
+ shapeColor = new Color(0, 0, 128);
+ }
+
+ public void setColorOlive() {
+ shapeColor = new Color(128, 128, 0);
+ }
+
+ public void setColorPurple() {
+ shapeColor = new Color(128, 0, 128);
+ }
+
+ public void setColorRed() {
+ shapeColor = new Color(255, 0, 0);
+ }
+
+ public void setColorSilver() {
+ shapeColor = new Color(192, 192, 192);
+ }
+
+ public void setColorTeal() {
+ shapeColor = new Color(0, 128, 128);
+ }
+
+ public void setColorWhite() {
+ shapeColor = new Color(255, 255, 255);
+ }
+
+ public void setColorYellow() {
+ shapeColor = new Color(255, 255, 0);
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ startPoint = previousPoint = e.getPoint();
+
+/// Instantiate object based on current mode ///
+ switch (currentMode) {
+
+ case FREEHAND:
+ case LINE:
+
+ drawing = new Line2D.Double();
+ break;
+
+ case ERASE:
+ case CIRCLE:
+ case OVAL:
+
+ drawing = new Ellipse2D.Double();
+ break;
+
+ case RECTANGLE:
+
+ drawing = new Rectangle2D.Double();
+ break;
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ switch (currentMode) {
+ case OVAL:
+ case RECTANGLE:
+ case CIRCLE:
+
+/// Abort drawing if 2D has no width or height ///
+ if (((RectangularShape) drawing).getWidth() == 0 || ((RectangularShape) drawing).getHeight() == 0) {
+ break;
+ }
+ case FREEHAND:
+ case LINE:
+// Graphics2D g2 = (Graphics2D) image.getGraphics();
+ g2.setColor(shapeColor);
+
+/// Uncomment the line below to fill the shapes with color ///
+// g2.fill(drawing);
+ g2.draw(drawing);
+ }
+
+ g2 = (Graphics2D) image.getGraphics();
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2.setColor(shapeColor);
+
+/// This repaint is needed if we want to fill the drawing shape with color
+ repaint();
+
+ drawing = null;
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ currentPoint = e.getPoint();
+
+ int x = Math.min(startPoint.x, e.getX());
+ int y = Math.min(startPoint.y, e.getY());
+ int width = Math.abs(startPoint.x - e.getX());
+ int height = Math.abs(startPoint.y - e.getY());
+
+ switch (currentMode) {
+
+/// Freehand drawing is continuously drawing line from current point to previous point ///
+ case FREEHAND:
+
+ ((Line2D) drawing).setLine(currentPoint, previousPoint);
+ g2.setColor(shapeColor);
+ g2.draw(drawing);
+ previousPoint = currentPoint;
+ break;
+
+/// Single line ///
+ case LINE:
+
+ ((Line2D) drawing).setLine(startPoint, currentPoint);
+ break;
+
+/// Eraser is continuously drawing "small white circle" from current point to previous point ///
+ case ERASE:
+
+ ((Ellipse2D) drawing).setFrame(currentPoint.getX(), currentPoint.getY(), 10, 10);
+ g2.setColor(Color.WHITE);
+ g2.fill(drawing);
+ g2.draw(drawing);
+ break;
+
+/// Single circle (How to draw more intuitively?)///
+ case CIRCLE:
+
+ double radius = Math.sqrt(width * width + height * height);
+// ((Ellipse2D) drawing).setFrame(x, y, radius, radius);
+ ((Ellipse2D) drawing).setFrame(startPoint.getX() - radius, startPoint.getY() - radius, 2 * radius, 2 * radius);
+ break;
+
+/// Single oval ///
+ case OVAL:
+
+ ((Ellipse2D) drawing).setFrame(x, y, width, height);
+ break;
+
+/// Single rectangle ///
+ case RECTANGLE:
+
+ ((Rectangle2D) drawing).setFrame(x, y, width, height);
+ break;
+ }
+
+ repaint();
+ }
+
+ @Override
+ public void mouseMoved(MouseEvent e) {
+
+ }
+}
\ No newline at end of file
diff --git a/src/GUI/MenuBar.java b/src/GUI/MenuBar.java
new file mode 100644
index 0000000000000000000000000000000000000000..b466e4b9cbe917d1c2acd97dee35ef4d995acfd8
--- /dev/null
+++ b/src/GUI/MenuBar.java
@@ -0,0 +1,7 @@
+package GUI;
+
+import javax.swing.*;
+
+public class MenuBar extends JMenuBar {
+ JButton clearBtn, newBtn, openBtn, saveBtn, saveAsBtn, closeBtn;
+}
diff --git a/src/GUI/PaintGUI.java b/src/GUI/PaintGUI.java
new file mode 100644
index 0000000000000000000000000000000000000000..40a63589b23c67847eade7ad28d6ae306516d3fd
--- /dev/null
+++ b/src/GUI/PaintGUI.java
@@ -0,0 +1,232 @@
+package GUI;
+
+import client.Client;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+
+public class PaintGUI extends JPanel {
+
+ Client client;
+
+ String[] shapes = {"Freehand", "Line", "Circle", "Rectangle", "Oval", "Eraser"};
+ String[] colors = {"Aqua", "Black", "Blue", "Fuchsia", "Gray", "Green", "Lime", "Maroon", "Navy", "Olive", "Purple", "Red", "Silver", "Teal", "White", "Yellow"};
+ JFrame frame;
+ JButton clearBtn, newBtn, openBtn, saveBtn, saveAsBtn, closeBtn;
+ JComboBox colorOptions;
+ JComboBox shapeOptions;
+ DrawingArea drawingArea;
+
+
+ JPanel global = new JPanel();
+ JFileChooser fileChooser= new JFileChooser();
+ JPanel toolbox = new JPanel();
+ JPanel fileControl = new JPanel();
+
+ /// GUI setup ///
+ public PaintGUI(Client client) {
+
+ this.client = client;
+
+/// Main drawing area ///
+ drawingArea = new DrawingArea(client);
+
+/// Set up main frame and container ///
+ global.setLayout(new BorderLayout());
+
+/// Set up elements ///
+ shapeOptions = new JComboBox(shapes);
+ shapeOptions.addActionListener(actionListener);
+ colorOptions = new JComboBox(colors);
+ colorOptions.setSelectedItem("Black");
+ colorOptions.addActionListener(actionListener);
+ clearBtn = new JButton("Clear");
+ clearBtn.addActionListener(actionListener);
+ newBtn = new JButton("New");
+ newBtn.addActionListener(actionListener);
+ openBtn = new JButton("Open");
+ openBtn.addActionListener(actionListener);
+ saveBtn = new JButton("Save");
+ saveBtn.addActionListener(actionListener);
+ saveAsBtn = new JButton("Save As");
+ saveAsBtn.addActionListener(actionListener);
+ closeBtn = new JButton("Close");
+ closeBtn.addActionListener(actionListener);
+
+/// Toolbox panel ///
+ toolbox.add(colorOptions);
+ toolbox.add(shapeOptions);
+ toolbox.add(clearBtn);
+
+/// File control panel ///
+ fileControl.add(newBtn);
+ fileControl.add(openBtn);
+ fileControl.add(saveBtn);
+ fileControl.add(saveAsBtn);
+ fileControl.add(closeBtn);
+
+/// Layout ///
+ global.add(fileControl, BorderLayout.NORTH);
+ global.add(drawingArea);
+ global.add(toolbox, BorderLayout.SOUTH);
+ }
+
+ public JPanel getGlobal() {
+ return global;
+ }
+
+ ActionListener actionListener = new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+
+/// Clear button ///
+ if (e.getSource() == clearBtn) {
+ drawingArea.clear();
+
+/// Create new canvas ///
+ } else if (e.getSource() == newBtn) {
+ int returnVal = JOptionPane.showConfirmDialog(new JFrame(), "Save your current whiteboard?", "Save or Discard", JOptionPane.YES_NO_CANCEL_OPTION);
+ if (returnVal == JOptionPane.YES_OPTION) {
+
+ drawingArea.saveFile();
+ drawingArea.clear();
+
+ } else if (returnVal == JOptionPane.NO_OPTION) {
+
+ drawingArea.clear();
+
+ }
+
+// Open file (PNG only) ///
+ } else if (e.getSource() == openBtn) {
+ int returnVal = fileChooser.showOpenDialog(frame);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fileChooser.getSelectedFile();
+ drawingArea.openFile(file);
+ }
+
+/// Save under project directory without filename (PNG file with default filename) ///
+ } else if (e.getSource() == saveBtn) {
+ drawingArea.saveFile();
+
+/// Save with other filename (PNG only) ///
+ } else if (e.getSource() == saveAsBtn) {
+ fileChooser = new JFileChooser();
+ int returnVal = fileChooser.showSaveDialog(frame);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fileChooser.getSelectedFile();
+ drawingArea.saveAsFile(file);
+ }
+
+/// Close application ///
+ } else if (e.getSource() == closeBtn) {
+ System.exit(0);
+
+/// Choose drawing color ///
+ } else if (e.getSource() == colorOptions) {
+
+ String colorChosen = (String) colorOptions.getSelectedItem();
+
+ switch (colorChosen){
+ case "Aqua":
+ drawingArea.setColorAqua();
+ break;
+ case "Black":
+ drawingArea.setColorBlack();
+ break;
+ case "Blue":
+ drawingArea.setColorBlue();
+ break;
+ case "Fuchsia":
+ drawingArea.setColorFuchsia();
+ break;
+ case "Gray":
+ drawingArea.setColorGray();
+ break;
+ case "Green":
+ drawingArea.setColorGreen();
+ break;
+ case "Lime":
+ drawingArea.setColorLime();
+ break;
+ case "Maroon":
+ drawingArea.setColorMaroon();
+ break;
+ case "Navy":
+ drawingArea.setColorNavy();
+ break;
+ case "Olive":
+ drawingArea.setColorOlive();
+ break;
+ case "Purple":
+ drawingArea.setColorPurple();
+ break;
+ case "Red":
+ drawingArea.setColorRed();
+ break;
+ case "Silver":
+ drawingArea.setColorSilver();
+ break;
+ case "Teal":
+ drawingArea.setColorTeal();
+ break;
+ case "White":
+ drawingArea.setColorWhite();
+ break;
+ case "Yellow":
+ drawingArea.setColorYellow();
+ break;
+ }
+
+/// Choose drawing tool ///
+ } else if (e.getSource() == shapeOptions) {
+
+ String shapeChosen = (String) shapeOptions.getSelectedItem();
+
+ switch (shapeChosen){
+ case "Freehand":
+ drawingArea.setModeFreehand();
+ break;
+ case "Line":
+ drawingArea.setModeLine();
+ break;
+ case "Circle":
+ drawingArea.setModeCircle();
+ break;
+ case "Rectangle":
+ drawingArea.setModeRectangle();
+ break;
+ case "Oval":
+ drawingArea.setModeOval();
+ break;
+ case "Eraser":
+ drawingArea.setModeErase();
+ break;
+ }
+ }
+ }
+ };
+
+ public DrawingArea getDrawingArea() {
+ return drawingArea;
+ }
+
+
+
+
+ public void showGUI() {
+ frame = new JFrame("Shared Whiteboard System");
+ JFrame.setDefaultLookAndFeelDecorated(true);
+ frame.setContentPane(global);
+
+ frame.setSize(800, 600);
+ frame.setLocationRelativeTo( null );
+ frame.setResizable(false);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setVisible(true);
+ }
+
+}
\ No newline at end of file
diff --git a/src/GUI/StartScreen.form b/src/GUI/StartScreen.form
new file mode 100644
index 0000000000000000000000000000000000000000..f266275f5779005b91d96dc1a9134323e557dfdb
--- /dev/null
+++ b/src/GUI/StartScreen.form
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="GUI.StartScreen">
+ <grid id="27dc6" binding="panel1" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="833" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <grid id="abaca" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <hspacer id="53fe0">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </hspacer>
+ <component id="ebca9" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Distributed Whiteboard App"/>
+ </properties>
+ </component>
+ <component id="d60e2" class="javax.swing.JTextArea" binding="information">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
+ <preferred-size width="150" height="50"/>
+ </grid>
+ </constraints>
+ <properties>
+ <editable value="false"/>
+ <text value="Welcome, please provide server's IP to connect to and nameto be identified by in the Whiteboard's chat."/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+ <grid id="790e1" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="87b91" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Your name:"/>
+ </properties>
+ </component>
+ <component id="e39f4" class="javax.swing.JTextField" binding="textField1" default-binding="true">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <preferred-size width="150" height="-1"/>
+ </grid>
+ </constraints>
+ <properties/>
+ </component>
+ <component id="ea0c1" class="javax.swing.JButton" binding="joinButton">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="JOIN WHITEBOARD"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+ <grid id="6ef31" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <hspacer id="23c9f">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </hspacer>
+ <component id="94078" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Server IP:"/>
+ </properties>
+ </component>
+ <component id="63209" class="javax.swing.JTextField" binding="textField2">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <preferred-size width="150" height="-1"/>
+ </grid>
+ </constraints>
+ <properties>
+ <text value=""/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+ </children>
+ </grid>
+</form>
diff --git a/src/GUI/StartScreen.java b/src/GUI/StartScreen.java
new file mode 100644
index 0000000000000000000000000000000000000000..10ae2adbd8c2b4b5a47b8974c2eec8ab072b57be
--- /dev/null
+++ b/src/GUI/StartScreen.java
@@ -0,0 +1,80 @@
+package GUI;
+
+import client.Client;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class StartScreen {
+
+ private JPanel panel1;
+ private JTextArea information;
+ private JTextField textField1;
+ private JButton joinButton;
+ private JTextField textField2;
+ JFrame frame;
+
+ private Client client;
+
+ public StartScreen(Client client)
+ {
+ this.client = client;
+ }
+
+// public static void main(String[] args) {
+// new StartScreen().go();
+// }
+
+
+ ActionListener actionListener = new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getSource() == joinButton)
+ {
+ String serverAddress = textField2.getText();
+ String userName = textField1.getText();
+
+ int connectionStatus = client.connect(userName, serverAddress);
+
+ if( connectionStatus == 1 )
+ {
+ frame.setVisible(false);
+ frame.dispose();
+ client.startApplication();
+ }
+ else if( connectionStatus == 2 )
+ {
+ showErrorMessage("Duplicate username: Please enter a new username");
+ }
+ else if( connectionStatus == 3 )
+ {
+ showErrorMessage("Cannot connect to server: Please check the server address");
+ }
+ else
+ {
+ showErrorMessage("Unknown Connection Status");
+ }
+ }
+ }
+
+ };
+
+ public static void showErrorMessage(String message)
+ {
+ JOptionPane.showMessageDialog(null,
+ message, "Error", JOptionPane.ERROR_MESSAGE);
+ }
+
+ public void go()
+ {
+ joinButton.addActionListener(actionListener);
+ frame = new JFrame("StartScreen");
+ frame.setContentPane(panel1);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setVisible(true);
+ }
+
+}
diff --git a/src/GUI/ToolBar.java b/src/GUI/ToolBar.java
new file mode 100644
index 0000000000000000000000000000000000000000..04087e80db705c26881b58bcde46bfead77687d7
--- /dev/null
+++ b/src/GUI/ToolBar.java
@@ -0,0 +1,100 @@
+package GUI;
+
+import javax.swing.*;
+import java.awt.*;
+
+public class ToolBar extends JPanel {
+ private DrawingArea drawingArea;
+
+ public ToolBar() {
+
+ }
+}
+
+class Tools extends JPanel {
+
+}
+
+class ColorPallete extends JPanel {
+ private Color color;
+
+ public ColorPallete() {
+ this.color = new Color(0, 0, 0); // Black
+ }
+
+ public void setColor(Color color) {
+ this.color = color;
+ }
+
+ public void setColorRBG(int r, int b, int g) {
+ this.color = new Color(r, b, g);
+ }
+
+ public Color getColor() {
+ return this.color;
+ }
+
+ public void setColorAqua() {
+ this.color = new Color(0,255, 255);
+ }
+
+ public void setColorBlack() {
+ this.color = new Color(0, 0, 0);
+ }
+
+ public void setColorBlue() {
+ this.color = new Color(0, 0, 255);
+ }
+
+ public void setColorFuchsia() {
+ this.color = new Color(255, 0, 255);
+ }
+
+ public void setColorGray() {
+ this.color = new Color(128, 128, 128);
+ }
+
+ public void setColorGreen() {
+ this.color = new Color(0, 128, 0);
+ }
+
+ public void setColorLime() {
+ this.color = new Color(0, 255, 0);
+ }
+
+ public void setColorMaroon() {
+ this.color = new Color(128,0, 0);
+ }
+
+ public void setColorNavy() {
+ this.color = new Color(0, 0, 128);
+ }
+
+ public void setColorOlive() {
+ this.color = new Color(128, 128, 0);
+ }
+
+ public void setColorPurple() {
+ this.color = new Color(128, 0, 128);
+ }
+
+ public void setColorRed() {
+ this.color = new Color(255, 0, 0);
+ }
+
+ public void setColorSilver() {
+ this.color = new Color(192, 192, 192);
+ }
+
+ public void setColorTeal() {
+ this.color = new Color(0, 128, 128);
+ }
+
+ public void setColorWhite() {
+ this.color = new Color(255, 255, 255);
+ }
+
+ public void setColorYellow() {
+ this.color = new Color(255, 255, 0);
+ }
+}
\ No newline at end of file
diff --git a/src/LICENSE b/src/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..ba0e33f6a054056eae2fdf79d3c4f4949e618044
--- /dev/null
+++ b/src/LICENSE
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ COMP90015-DSAss2-InfinityMonkeys-remaster
+ Copyright (C) 2019 Ho Dac Hai
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ {signature of Ty Coon}, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/src/client/ChatUpdate.java b/src/client/ChatUpdate.java
new file mode 100644
index 0000000000000000000000000000000000000000..2edc3ccdd3c5a1c5262fdc2107d9f28b74b556ce
--- /dev/null
+++ b/src/client/ChatUpdate.java
@@ -0,0 +1,52 @@
+package client;
+
+import remote.IChatUpdate;
+
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+public class ChatUpdate extends UnicastRemoteObject implements IChatUpdate, Serializable
+{
+ private Client client;
+
+ public ChatUpdate(Client client) throws RemoteException
+ {
+ super();
+ this.client = client;
+ }
+
+ @Override
+ public boolean notifyChat(String fromClient, String message, boolean isPrivate) throws RemoteException
+ {
+ String outputString;
+
+ if( isPrivate )
+ {
+ outputString = "PRIVATE (from " + fromClient + "): " + message + "\n";
+ }
+ else
+ {
+ outputString = fromClient + ": " + message + "\n";
+ }
+
+ client.getApplicationMain().getChatScreen().getChatDisplayBox().append(outputString);
+
+ //client.setReceivedMessage(message);
+ //System.out.println(fromClient + ": " + message);
+ return true;
+ }
+
+ @Override
+ public boolean notifyUserLogin(String fromClient) throws RemoteException {
+ client.getApplicationMain().getChatScreen().getChatDisplayBox().append(fromClient + " has joined the room.\n");
+ return true;
+ }
+
+ @Override
+ public boolean notifyUserLogout(String fromClient) throws RemoteException {
+ client.getApplicationMain().getChatScreen().getChatDisplayBox().append(fromClient + " has left the room.\n");
+ return true;
+ }
+
+}
diff --git a/src/client/Client.java~origin_master b/src/client/Client.java~origin_master
new file mode 100644
index 0000000000000000000000000000000000000000..3edda911f8e581fa2eb7d576173e811ce6bb7abf
--- /dev/null
+++ b/src/client/Client.java~origin_master
@@ -0,0 +1,122 @@
+package client;
+
+import GUI.ApplicationMain;
+import GUI.ChatScreen;
+import GUI.PaintGUI;
+import GUI.StartScreen;
+import remote.IChatController;
+import remote.IClientController;
+import remote.IDrawingController;
+
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+public class Client
+{
+ private String userName;
+ private String serverAddress;
+
+ private Registry registryServer;
+ private IChatController chatController;
+ private IClientController clientController;
+ private IDrawingController drawingController;
+
+ private ClientUpdate clientUpdate;
+ private ChatUpdate chatUpdate;
+ private DrawingUpdate drawingUpdate;
+
+ private StartScreen startScreen;
+ private ChatScreen chatScreen;
+ private PaintGUI paintGUI;
+
+ public ApplicationMain getApplicationMain() { return applicationMain; }
+
+ private ApplicationMain applicationMain;
+
+ public PaintGUI getPaintGUI() { return paintGUI; }
+
+
+ public ChatScreen getChatScreen() { return chatScreen; }
+
+ public IChatController getChatController()
+ {
+ return chatController;
+ }
+
+ public IClientController getClientController()
+ {
+ return clientController;
+ }
+
+ public IDrawingController getDrawingController() { return drawingController; }
+
+ public void setUsername(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public String getUserName()
+ {
+ return this.userName;
+ }
+
+ public void setServerAddress(String serverAddress)
+ {
+ this.serverAddress = serverAddress;
+ }
+
+ public Client(String username) throws RemoteException
+ {
+ this.userName = username;
+ this.clientUpdate = new ClientUpdate(this);
+ this.chatUpdate = new ChatUpdate(this);
+ this.drawingUpdate = new DrawingUpdate(this);
+// this.startScreen = new StartScreen(this);
+// this.chatScreen = new ChatScreen(this);
+// this.paintGUI = new PaintGUI(this);
+ this.applicationMain = new ApplicationMain(this);
+
+ }
+
+ public static void main(String[] args)
+ {
+ try
+ {
+ Client client = new Client(args[0]);
+ client.connect();
+// client.getChatScreen().showGUI();
+// client.getPaintGUI().showGUI();
+ client.getApplicationMain().createAndShowGUI();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public boolean connect()
+ {
+ try
+ {
+ registryServer = LocateRegistry.getRegistry(serverAddress);
+
+ chatController = (IChatController) registryServer.lookup("ChatController");
+ clientController = (IClientController) registryServer.lookup("ClientController");
+ drawingController = (IDrawingController) registryServer.lookup("DrawingController");
+
+ if (clientController.join(userName, this.chatUpdate, this.clientUpdate, this.drawingUpdate))
+ {
+ System.out.println("Connected to server");
+
+ return true;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/src/client/ClientUpdate.java b/src/client/ClientUpdate.java
new file mode 100644
index 0000000000000000000000000000000000000000..5509665ab52c57f0cdde76c83b3d23190f82dc10
--- /dev/null
+++ b/src/client/ClientUpdate.java
@@ -0,0 +1,66 @@
+package client;
+
+import remote.IClientUpdate;
+
+import javax.swing.*;
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+public class ClientUpdate extends UnicastRemoteObject implements IClientUpdate, Serializable {
+
+ private Client client;
+
+ public ClientUpdate(Client client) throws RemoteException
+ {
+ super();
+ this.client = client;
+ }
+
+ @Override
+ public boolean notifyClient(String fromClient, String newUsername) throws RemoteException
+ {
+ client.getApplicationMain().getChatScreen().getSendMessageToComboBox().addItem(newUsername);
+
+ return true;
+ }
+
+ // for debuggins purposes
+ private void printUserList(String[] users)
+ {
+ System.out.print("Currently connected users: ");
+ for( String s : users )
+ {
+ System.out.print(s + " ");
+ }
+ System.out.println();
+ }
+
+ @Override
+ public boolean updateUserList(String[] users) throws RemoteException
+ {
+ printUserList(users);
+
+
+ System.out.println("TEST1");
+ JComboBox userBox = client.getApplicationMain().getChatScreen().getSendMessageToComboBox();
+
+ System.out.println("TEST2");
+ userBox.removeAllItems();
+
+ System.out.println("TEST3");
+ userBox.addItem("All");
+
+ System.out.println("TEST4");
+ for( String s : users )
+ {
+ if( !s.equals(client.getUserName()) )
+ {
+ userBox.addItem(s);
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/src/client/DrawingUpdate.java b/src/client/DrawingUpdate.java
new file mode 100644
index 0000000000000000000000000000000000000000..4b41c0285681b1674f9b35cc61336ca6d4451426
--- /dev/null
+++ b/src/client/DrawingUpdate.java
@@ -0,0 +1,29 @@
+package client;
+
+import GUI.DrawingArea;
+import remote.IDrawingUpdate;
+
+import java.awt.*;
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate, Serializable {
+
+ private Client client;
+
+ public DrawingUpdate(Client client) throws RemoteException {
+ super();
+ this.client = client;
+ }
+
+ @Override
+ public boolean notifyDrawing(String fromClient, Shape drawing) throws RemoteException {
+ client.getApplicationMain().getPaintGUI().getDrawingArea().setDrawing(drawing);
+ client.getApplicationMain().getPaintGUI().getDrawingArea().repaint();
+// DrawingArea drawingArea = (DrawingArea) client.getChatScreen().getDrawingPanel().getComponent(1);
+// drawingArea.setDrawing(drawing);
+// drawingArea.repaint();
+ return false;
+ }
+}
diff --git a/src/remote/IChatController.java b/src/remote/IChatController.java
new file mode 100644
index 0000000000000000000000000000000000000000..82305870e4b5438637dc6b8759ce3235b6a02dd0
--- /dev/null
+++ b/src/remote/IChatController.java
@@ -0,0 +1,12 @@
+package remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface IChatController extends Remote
+{
+ boolean broadcastMessage(String fromClient, String message) throws RemoteException;
+ boolean broadcastMessageUserLogin(String fromClient) throws RemoteException;
+ boolean broadcastMessageUserLogout(String fromClient) throws RemoteException;
+ boolean sendPrivateMessage(String fromClient, String toClient, String message) throws RemoteException;
+}
diff --git a/src/remote/IChatUpdate.java b/src/remote/IChatUpdate.java
new file mode 100644
index 0000000000000000000000000000000000000000..0c9b54d9daab6367372e1987f2c988a94bcbde8d
--- /dev/null
+++ b/src/remote/IChatUpdate.java
@@ -0,0 +1,12 @@
+package remote;
+
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface IChatUpdate extends Remote, Serializable
+{
+ boolean notifyChat(String fromClient, String message, boolean isPrivate) throws RemoteException;
+ boolean notifyUserLogin(String fromClient) throws RemoteException;
+ boolean notifyUserLogout(String fromClient) throws RemoteException;
+}
diff --git a/src/remote/IClientController.java b/src/remote/IClientController.java
new file mode 100644
index 0000000000000000000000000000000000000000..bde0a0f500ed01f94c2485ba8de0bdea378d05d9
--- /dev/null
+++ b/src/remote/IClientController.java
@@ -0,0 +1,15 @@
+package remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface IClientController extends Remote
+{
+ boolean join(String username, IChatUpdate clientChat, IClientUpdate clientUpdate, IDrawingUpdate clientDrawing) throws RemoteException;
+
+ void quit(String username) throws RemoteException;
+
+ boolean assignAdmin(String username) throws RemoteException;
+
+ boolean kickUser(String username, String who) throws RemoteException;
+}
diff --git a/src/remote/IClientUpdate.java b/src/remote/IClientUpdate.java
new file mode 100644
index 0000000000000000000000000000000000000000..c1337f90f560c6b527bd067d7d5d2cf0d85ee234
--- /dev/null
+++ b/src/remote/IClientUpdate.java
@@ -0,0 +1,12 @@
+package remote;
+
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface IClientUpdate extends Remote, Serializable {
+
+ boolean notifyClient(String fromClient, String newUsername) throws RemoteException;
+
+ boolean updateUserList(String[] users) throws RemoteException;
+}
diff --git a/src/remote/IDrawingController.java b/src/remote/IDrawingController.java
new file mode 100644
index 0000000000000000000000000000000000000000..145cc49619dcab3c25de449b706221fff56ecab6
--- /dev/null
+++ b/src/remote/IDrawingController.java
@@ -0,0 +1,21 @@
+package remote;
+
+import java.awt.*;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+
+/**
+ * RMI Remote interface - must be shared between client and server.
+ * All methods must throw RemoteException.
+ * All parameters and return types must be either primitives or Serializable.
+ *
+ * Any object that is a remote object must implement this interface.
+ * Only those methods specified in a "remote interface" are available remotely.
+ */
+public interface IDrawingController extends Remote {
+
+ boolean broadcastDrawing(String fromClient, Shape drawing) throws RemoteException;
+
+
+}
diff --git a/src/remote/IDrawingUpdate.java b/src/remote/IDrawingUpdate.java
new file mode 100644
index 0000000000000000000000000000000000000000..3df14ff51b7f3bbb41069b15f36ea23627699439
--- /dev/null
+++ b/src/remote/IDrawingUpdate.java
@@ -0,0 +1,10 @@
+package remote;
+
+import java.awt.*;
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface IDrawingUpdate extends Remote, Serializable {
+ boolean notifyDrawing(String fromClient, Shape drawing) throws RemoteException;
+}
diff --git a/src/server/ChatController.java b/src/server/ChatController.java
new file mode 100644
index 0000000000000000000000000000000000000000..a2a38a03e75bb952ed298a7f8050029cb38b0324
--- /dev/null
+++ b/src/server/ChatController.java
@@ -0,0 +1,87 @@
+package server;
+
+import remote.IChatController;
+import remote.IChatUpdate;
+
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+public class ChatController extends UnicastRemoteObject implements IChatController, Serializable
+{
+ private Server server;
+
+ public ChatController(Server server) throws RemoteException
+ {
+ this.server = server;
+ }
+
+ @Override
+ public boolean broadcastMessage(String fromClient, String message) throws RemoteException
+ {
+ System.out.print("Broadcasting message to everyone...");
+
+ for( User u : server.users )
+ {
+ u.getIChatUpdate().notifyChat(fromClient, message, false);
+ }
+
+ System.out.print("...DONE\n");
+
+ return true;
+ }
+
+ @Override
+ public boolean broadcastMessageUserLogin(String fromClient) throws RemoteException {
+ System.out.print("Broadcasting message to everyone...");
+
+ IChatUpdate client;
+
+ for( User u : server.users )
+ {
+ client = u.getIChatUpdate();
+ client.notifyUserLogin(fromClient);
+ }
+
+ System.out.print("...DONE\n");
+ System.out.println(fromClient + " has joined the room.");
+
+ return true;
+ }
+
+ @Override
+ public boolean broadcastMessageUserLogout(String fromClient) throws RemoteException {
+ System.out.print("Broadcasting message to everyone...");
+
+ IChatUpdate client;
+
+ for( User u : server.users )
+ {
+ client = u.getIChatUpdate();
+ client.notifyUserLogout(fromClient);
+ }
+
+ System.out.print("...DONE\n");
+ System.out.println(fromClient + " has left the room.");
+
+ return true;
+ }
+
+ @Override
+ public boolean sendPrivateMessage(String fromClient, String toClient, String message) throws RemoteException
+ {
+ int toClientIndex = server.clientController.getUserIndex(toClient);
+ int fromClientIndex = server.clientController.getUserIndex(fromClient);
+
+ if( toClientIndex >= 0 && fromClientIndex >= 0 )
+ {
+ server.users.get(toClientIndex).getIChatUpdate().notifyChat(fromClient, message, true);
+
+ server.users.get(fromClientIndex).getIChatUpdate().notifyChat(fromClient, message, true);
+
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/src/server/ClientController.java~origin_master b/src/server/ClientController.java~origin_master
new file mode 100644
index 0000000000000000000000000000000000000000..5e7638f48e3e3307b6929a968b425e40722575a2
--- /dev/null
+++ b/src/server/ClientController.java~origin_master
@@ -0,0 +1,122 @@
+package server;
+
+import remote.IChatUpdate;
+import remote.IClientUpdate;
+import remote.IDrawingUpdate;
+import remote.IClientController;
+
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+public class ClientController extends UnicastRemoteObject implements IClientController, Serializable
+{
+ private Server server;
+
+ protected ClientController(Server server) throws RemoteException
+ {
+ this.server = server;
+ }
+
+ @Override
+ public boolean join(String username, IChatUpdate clientChat, IClientUpdate clientUpdate, IDrawingUpdate clientDrawing) throws RemoteException
+ {
+ server.chatController.broadcastMessageUserLogin(username);
+
+ User newUser = new User(username, clientChat, clientUpdate, clientDrawing);
+
+ server.users.add(newUser);
+
+ if(server.users.size() == 1)
+ {
+ server.users.get(0).setAdmin(true);
+ }
+
+ System.out.println(username + " registered successfully");
+
+ broadcastUserList();
+
+ return true;
+ }
+
+ @Override
+ public void quit(String username) throws RemoteException
+ {
+ int userIndex = getUserIndex(username);
+
+ if( userIndex >= 0 )
+ {
+ server.users.remove(userIndex);
+
+ server.chatController.broadcastMessageUserLogout(username);
+
+ broadcastUserList();
+ }
+ }
+
+ @Override
+ public boolean assignAdmin(String username) throws RemoteException
+ {
+ int adminIndex = getUserIndex(username);
+
+ if( adminIndex >= 0 )
+ {
+ server.users.get(adminIndex).setAdmin(true);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean kickUser(String username, String who) throws RemoteException
+ {
+ int userIndex = getUserIndex(who);
+
+ int adminIndex = getUserIndex(username);
+
+ if ( adminIndex > 0 && userIndex > 0 && server.users.get(adminIndex).isAdmin() )
+ {
+ server.users.remove(userIndex);
+
+ broadcastUserList();
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public int getUserIndex(String username)
+ {
+ int index = -1;
+
+ for( int i = 0; i < server.users.size(); i++ )
+ {
+ if( server.users.get(i).getUserName().equals(username) )
+ {
+ index = i;
+ break;
+ }
+ }
+
+ return index;
+ }
+
+ private void broadcastUserList() throws RemoteException
+ {
+ String[] connectedUsers = new String[server.users.size()];
+
+ for( int i = 0; i<server.users.size(); i++ )
+ {
+ connectedUsers[i] = server.users.get(i).getUserName();
+ }
+
+ for( User u : server.users )
+ {
+ u.getIClientUpdate().updateUserList(connectedUsers);
+ }
+ }
+}
diff --git a/src/server/DrawingController.java b/src/server/DrawingController.java
new file mode 100644
index 0000000000000000000000000000000000000000..1471e8a38a33c3fc1d496f36ffa306ad0f0a1888
--- /dev/null
+++ b/src/server/DrawingController.java
@@ -0,0 +1,34 @@
+package server;
+
+import remote.IDrawingController;
+import remote.IDrawingUpdate;
+
+import java.awt.*;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+public class DrawingController extends UnicastRemoteObject implements IDrawingController {
+
+ private Server server;
+
+ protected DrawingController(Server server) throws RemoteException {
+ this.server = server;
+ }
+
+ @Override
+ public boolean broadcastDrawing(String fromClient, Shape drawing) throws RemoteException {
+ System.out.print("Broadcasting drawing to everyone...");
+
+ IDrawingUpdate client;
+
+ for( User u : server.users )
+ {
+ client = u.getIDrawingUpdate();
+ client.notifyDrawing(fromClient, drawing);
+ }
+
+ System.out.print("...DONE\n");
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/server/Server.java b/src/server/Server.java
new file mode 100644
index 0000000000000000000000000000000000000000..65842248bec9de49f36f79a9e29c9e2eface21a3
--- /dev/null
+++ b/src/server/Server.java
@@ -0,0 +1,62 @@
+package server;
+
+import remote.IChatController;
+import remote.IClientController;
+import remote.IDrawingController;
+
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.ArrayList;
+
+public class Server
+{
+ protected ArrayList<User> users;
+
+ protected ClientController clientController;
+ protected ChatController chatController;
+ protected DrawingController drawingController;
+
+ public Server() throws RemoteException
+ {
+ users = new ArrayList<User>();
+ clientController = new ClientController(this);
+ chatController = new ChatController(this);
+ drawingController = new DrawingController(this);
+ }
+
+ public static void main(String[] args)
+ {
+ try
+ {
+ Server server = new Server();
+
+ server.run();
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void run() throws RemoteException
+ {
+
+ LocateRegistry.createRegistry(1099);
+ Registry registry = LocateRegistry.getRegistry();
+
+ String clientControllerName = "ClientController";
+ String chatControllerName = "ChatController";
+ String drawingControllerName = "DrawingController";
+
+ IClientController clientController = new ClientController(this);
+ IChatController chatController = new ChatController(this);
+ IDrawingController drawingController = new DrawingController(this);
+
+ registry.rebind(clientControllerName, clientController);
+ registry.rebind(chatControllerName, chatController);
+ registry.rebind(drawingControllerName, drawingController);
+
+ System.out.println("Server is ready");
+ }
+}
diff --git a/src/server/User.java~origin_master b/src/server/User.java~origin_master
new file mode 100644
index 0000000000000000000000000000000000000000..543f26e6c9056a69b382ae8dc4819d4116e95559
--- /dev/null
+++ b/src/server/User.java~origin_master
@@ -0,0 +1,47 @@
+package server;
+
+import remote.IChatUpdate;
+import remote.IClientUpdate;
+import remote.IDrawingUpdate;
+
+public class User
+{
+ private String username;
+ private IChatUpdate IChatUpdate;
+ private IDrawingUpdate IDrawingUpdate;
+ private IClientUpdate IClientUpdate;
+ private boolean isAdmin;
+
+ public User(String username, IChatUpdate IChatUpdate, IClientUpdate IClientUpdate, IDrawingUpdate IDrawingUpdate)
+ {
+ this.username = username;
+ this.IChatUpdate = IChatUpdate;
+ this.IDrawingUpdate = IDrawingUpdate;
+ this.IClientUpdate = IClientUpdate;
+ this.isAdmin = false;
+ }
+
+ public String getUserName()
+ {
+ return this.username;
+ }
+
+ public void setAdmin(boolean admin)
+ {
+ isAdmin = admin;
+ }
+
+ public boolean isAdmin()
+ {
+ return isAdmin;
+ }
+
+ public IChatUpdate getIChatUpdate()
+ {
+ return this.IChatUpdate;
+ }
+
+ public IDrawingUpdate getIDrawingUpdate() { return this.IDrawingUpdate; }
+
+ public IClientUpdate getIClientUpdate() { return this.IClientUpdate; }
+}