diff --git a/src/GUI/ChatScreen.form b/src/GUI/ChatScreen.form index 05bc77bc7c92c0705b176c7bbc1ab31ab2bf8e08..7ff8dffbe24b88abe437e256e76198ea323b9a90 100644 --- a/src/GUI/ChatScreen.form +++ b/src/GUI/ChatScreen.form @@ -3,39 +3,16 @@ <grid id="27dc6" binding="panel2" 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> - <xy x="20" y="20" width="500" height="400"/> + <xy x="20" y="20" width="1200" height="1200"/> </constraints> - <properties/> + <properties> + <maximumSize width="-1" height="-1"/> + <minimumSize width="-1" height="-1"/> + <preferredSize width="1200" height="700"/> + </properties> <border type="none"/> <children> - <grid id="b9a73" layout-manager="GridLayoutManager" row-count="1" 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="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"> - <preferred-size width="120" height="20"/> - </grid> - </constraints> - <properties> - <background color="-6578270"/> - </properties> - <border type="none"/> - <children> - <component id="b2458" class="javax.swing.JButton" binding="quitButton" default-binding="true"> - <constraints> - <grid row="0" column="1" 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"/> - </properties> - </component> - <hspacer id="3f7a8"> - <constraints> - <grid row="0" 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> - </children> - </grid> - <grid id="b37e3" layout-manager="GridLayoutManager" row-count="4" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> + <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="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> @@ -43,77 +20,188 @@ <properties/> <border type="none"/> <children> - <hspacer id="1000b"> - <constraints> - <grid row="2" column="1" row-span="1" col-span="2" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> - </constraints> - </hspacer> - <vspacer id="d2a11"> + <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="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> - </constraints> - </vspacer> - <scrollpane id="55ee"> - <constraints> - <grid row="1" column="0" row-span="1" col-span="3" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/> + <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"/> + <border type="none" title="My Area"/> <children> - <component id="e8d87" class="javax.swing.JTextArea" binding="chatOutputArea"> - <constraints/> + <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> - <editable value="false"/> + <font size="14" style="1"/> + <text value="Manager's Name:"/> </properties> </component> - </children> - </scrollpane> - <component id="9e940" class="javax.swing.JButton" binding="send"> - <constraints> - <grid row="3" column="2" 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> - <component id="f1743" class="javax.swing.JTextArea" binding="chatInputArea"> - <constraints> - <grid row="3" 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"/> + <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> - </constraints> - <properties/> - </component> - <scrollpane id="5b85e"> + <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="1" column="3" row-span="3" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/> + <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"/> + <border type="none" title="Chat Area"/> <children> - <component id="15b62" class="javax.swing.JTextArea" binding="userListArea"> - <constraints/> + <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="sentMessageToComboBox"> + <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> - </scrollpane> - <component id="a35da" class="javax.swing.JLabel"> - <constraints> - <grid row="0" column="3" 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="Users"/> - </properties> - </component> + </grid> </children> </grid> - <grid id="c0bac" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> + <grid id="be22c" binding="drawingPanel" custom-create="true" 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> - <grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> + <grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/> </constraints> <properties/> - <border type="none"/> + <border type="none" title="Drawing Area"/> <children/> </grid> </children> diff --git a/src/GUI/ChatScreen.java b/src/GUI/ChatScreen.java index d2421903134b59d24171516bae0a190556e04150..987974f39199f5665b53d606cde6658e9228edcf 100644 --- a/src/GUI/ChatScreen.java +++ b/src/GUI/ChatScreen.java @@ -12,41 +12,70 @@ import java.rmi.RemoteException; public class ChatScreen { public JPanel panel2; + private JButton sendButton; + private JPanel drawingPanel; + private JPanel othersPanel; + private JComboBox sentMessageToComboBox; + 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 JButton send; + private JFrame frame; + + private Client client; + - public JTextArea getChatOutputArea() + public ChatScreen(Client client) { - return chatOutputArea; + this.client = client; + yourNameDisplay.setText(client.getUserName()); +// sentMessageToComboBox.addItem(client.getUserName()); + quitButton.addActionListener(actionListener); + sendButton.addActionListener(actionListener); + frame = new JFrame("Application"); + frame.setContentPane(panel2); + createUIComponents(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setResizable(false); + frame.setVisible(true); } - private JTextArea chatOutputArea; - private JTextArea chatInputArea; - - public JTextArea getUserListArea() { - return userListArea; + private void createUIComponents() { + drawingPanel = new PaintGUI(client).getGlobal(); } - private JTextArea userListArea; - private JPanel ryanPanel; - private JPanel x; - private JFrame frame; + public JTextArea getChatDisplayBox() { + return chatDisplayBox; + } - private Client client; + public JComboBox getSentMessageToComboBox() { + return sentMessageToComboBox; + } - public void setChatOutput(String message) - { - this.chatOutputArea.setText(message); + public JPanel getDrawingPanel() { + return drawingPanel; } ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { - if (e.getSource() == send) + if (e.getSource() == sendButton) { - String message = chatInputArea.getText(); - chatInputArea.setText(""); + String message = chatInputBox.getText(); + chatInputBox.setText(""); IChatController chatController = client.getChatController(); try { @@ -58,12 +87,12 @@ public class ChatScreen { ex.printStackTrace(); } } - else if (e.getSource() == quitButton) + else if (e.getSource() == exitThisRoomButton) { IClientController clientController = client.getClientController(); try { - System.out.println("Quit button pressed"); + System.out.println("Exit room button pressed"); clientController.quit(client.getUserName()); System.exit(0); } @@ -75,38 +104,4 @@ public class ChatScreen { } }; - - - public ChatScreen(Client client) - { - this.client = client; - quitButton.addActionListener(actionListener); - send.addActionListener(actionListener); - frame = new JFrame("ChatScreen"); - frame.setContentPane(panel2); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.pack(); - frame.setVisible(true); -// createUIComponents(); - } - - -// private void createUIComponents() { -// ryanPanel = new PaintGUI().getGlobal(); -// -// } - -// public static void main (String[] args) { -// ChatScreen chatScreen = new ChatScreen(); -// chatScreen.go(); -// } - -// public void go(){ -// //joinButton.addActionListener(actionListener); -// frame = new JFrame("App"); -// frame.setContentPane(panel2); -// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); -// frame.pack(); -// frame.setVisible(true); -// } } diff --git a/src/GUI/DrawingArea.java b/src/GUI/DrawingArea.java index b2349f28ff776cae3cb9e1f9b0b8ca6d284c0150..21069490ac09b3a85c3eb35b876440ee928f206a 100644 --- a/src/GUI/DrawingArea.java +++ b/src/GUI/DrawingArea.java @@ -27,7 +27,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis /// Canvas size parameter /// private final static int AREA_WIDTH = 600; - private final static int AREA_HEIGHT = 500; + private final static int AREA_HEIGHT = 620; /// Shape to be drawn on the canvas /// private Client client; diff --git a/src/GUI/PaintGUI.java b/src/GUI/PaintGUI.java index 90641c9ef906983ec5bb2bb80f8721fadbd174fc..78fa2e8dc6516636633e884d905750fe930dc41b 100644 --- a/src/GUI/PaintGUI.java +++ b/src/GUI/PaintGUI.java @@ -18,22 +18,64 @@ public class PaintGUI extends JPanel { JButton clearBtn, newBtn, openBtn, saveBtn, saveAsBtn, closeBtn; JComboBox colorOptions; JComboBox shapeOptions; - - public DrawingArea getDrawingArea() { - return drawingArea; - } - DrawingArea drawingArea; Client client; + 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; } - JPanel global = new JPanel(); - JFileChooser fileChooser= new JFileChooser(); - JPanel toolbox = new JPanel(); - JPanel fileControl = new JPanel(); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -166,66 +208,23 @@ public class PaintGUI extends JPanel { } }; -/// Main program /// - - -/// 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); + public DrawingArea getDrawingArea() { + return drawingArea; + } -/// 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 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); - } +// 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/client/ChatUpdate.java b/src/client/ChatUpdate.java index e12ac0337543a525a050c67d51de4dbb98f13b3c..986f6a70224f04c9516b4c0813cd90305cf79f4b 100644 --- a/src/client/ChatUpdate.java +++ b/src/client/ChatUpdate.java @@ -19,7 +19,7 @@ public class ChatUpdate extends UnicastRemoteObject implements IChatUpdate, Seri @Override public boolean notifyChat(String fromClient, String message) throws RemoteException { - client.getChatScreen().getChatOutputArea().append(fromClient + ": " + message + "\n"); + client.getChatScreen().getChatDisplayBox().append(fromClient + ": " + message + "\n"); //client.setReceivedMessage(message); System.out.println(fromClient + ": " + message); @@ -28,13 +28,13 @@ public class ChatUpdate extends UnicastRemoteObject implements IChatUpdate, Seri @Override public boolean notifyUserLogin(String fromClient) throws RemoteException { - client.getChatScreen().getChatOutputArea().append(fromClient + " has joined the room.\n"); + client.getChatScreen().getChatDisplayBox().append(fromClient + " has joined the room.\n"); return true; } @Override public boolean notifyUserLogout(String fromClient) throws RemoteException { - client.getChatScreen().getChatOutputArea().append(fromClient + " has left the room.\n"); + client.getChatScreen().getChatDisplayBox().append(fromClient + " has left the room.\n"); return true; } diff --git a/src/client/Client.java b/src/client/Client.java index 5d11a48b9d1d3d3b7a15bd249ced4f14e6370f1a..592b566b80efe3215d31915b4e0ece0bac29fc65 100644 --- a/src/client/Client.java +++ b/src/client/Client.java @@ -20,21 +20,19 @@ public class Client 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 StartScreen startScreen; private ChatScreen chatScreen; - private PaintGUI paintGUI; +// private PaintGUI paintGUI; - public PaintGUI getPaintGUI() { - return paintGUI; - } +// public PaintGUI getPaintGUI() { +// return paintGUI; +// } public ChatScreen getChatScreen() @@ -81,7 +79,7 @@ public class Client this.drawingUpdate = new DrawingUpdate(this); this.startScreen = new StartScreen(this); this.chatScreen = new ChatScreen(this); - this.paintGUI = new PaintGUI(this); +// this.paintGUI = new PaintGUI(this); } public static void main(String[] args) @@ -91,7 +89,7 @@ public class Client Client client = new Client(args[0]); client.connect(); // client.startScreen.go(); - client.getPaintGUI().showGUI(); +// client.getPaintGUI().showGUI(); } catch (Exception e) { @@ -99,22 +97,6 @@ public class Client } } -// public void doSomething() -// { -//// new ChatScreen(); -// -// try -// { -// new ChatScreen(this); -// System.out.println("Sleeping..."); -// TimeUnit.MINUTES.sleep(5); -// } -// catch(Exception e) -// { -// e.printStackTrace(); -// } -// } - public boolean connect() { try @@ -139,14 +121,4 @@ public class Client return false; } - - public String getReceivedMessage() - { - return receivedMessage; - } - - public void setReceivedMessage(String receivedMessage) - { - this.receivedMessage = receivedMessage; - } } \ No newline at end of file diff --git a/src/client/ClientUpdate.java b/src/client/ClientUpdate.java index 7320c7b76e3e6c1d9c23b523dcb6f1741f4e8935..4faa2723f8733cb457feb1c3c7696330b5e02b56 100644 --- a/src/client/ClientUpdate.java +++ b/src/client/ClientUpdate.java @@ -19,7 +19,7 @@ public class ClientUpdate extends UnicastRemoteObject implements IClientUpdate, @Override public boolean notifyClient(String fromClient, String newUsername) throws RemoteException { - client.getChatScreen().getUserListArea().setText(newUsername); + client.getChatScreen().getSentMessageToComboBox().addItem(newUsername); return true; } diff --git a/src/client/DrawingUpdate.java b/src/client/DrawingUpdate.java index 7716e995e7ace7276607d281cb548b6c61dd76c6..1a6cf0cdb3972d33ed25720fd5a6073390647fa1 100644 --- a/src/client/DrawingUpdate.java +++ b/src/client/DrawingUpdate.java @@ -18,8 +18,9 @@ public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate @Override public boolean notifyDrawing(String fromClient, Shape drawing) throws RemoteException { - client.getPaintGUI().getDrawingArea().setDrawing(drawing); - client.getPaintGUI().getDrawingArea().repaint(); +// client.getPaintGUI().getDrawingArea().setDrawing(drawing); +// client.getPaintGUI().getDrawingArea().repaint(); + client.getChatScreen().getDrawingPanel().getRootPane(); return false; } }