Skip to content
Snippets Groups Projects
Commit 37a6af2e authored by Pedroza Aguirre Isaac's avatar Pedroza Aguirre Isaac
Browse files

Max changes

parent 9b73019d
No related branches found
No related tags found
No related merge requests found
Showing
with 33 additions and 31 deletions
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<properties> <properties>
<maximumSize width="-1" height="-1"/> <maximumSize width="-1" height="-1"/>
<minimumSize width="-1" height="-1"/> <minimumSize width="-1" height="-1"/>
<preferredSize width="1200" height="700"/> <preferredSize width="1200" height="600"/>
</properties> </properties>
<border type="none"/> <border type="none"/>
<children> <children>
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
<text value="Send Message To:"/> <text value="Send Message To:"/>
</properties> </properties>
</component> </component>
<component id="cc35d" class="javax.swing.JComboBox" binding="sentMessageToComboBox"> <component id="cc35d" class="javax.swing.JComboBox" binding="sendMessageToComboBox">
<constraints> <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"/> <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> </constraints>
......
...@@ -15,7 +15,7 @@ public class ChatScreen { ...@@ -15,7 +15,7 @@ public class ChatScreen {
private JButton sendButton; private JButton sendButton;
private JPanel drawingPanel; private JPanel drawingPanel;
private JPanel othersPanel; private JPanel othersPanel;
private JComboBox sentMessageToComboBox; private JComboBox sendMessageToComboBox;
private JTextArea chatDisplayBox; private JTextArea chatDisplayBox;
private JComboBox userSelectComboBox; private JComboBox userSelectComboBox;
private JButton kickOutButton; private JButton kickOutButton;
...@@ -33,30 +33,38 @@ public class ChatScreen { ...@@ -33,30 +33,38 @@ public class ChatScreen {
private JButton quitButton; private JButton quitButton;
private JFrame frame; private JFrame frame;
public Client getClient() { private Client client;
return client;
}
public Client client;
public ChatScreen(Client client) public ChatScreen(Client client)
{ {
this.client = client; this.client = client;
exitThisRoomButton.addActionListener(actionListener);
sendButton.addActionListener(actionListener);
yourNameDisplay.setText(client.getUserName()); yourNameDisplay.setText(client.getUserName());
drawingPanel = new PaintGUI(client); // 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);
SwingUtilities.getRootPane(sendButton).setDefaultButton(sendButton);
}
private void createUIComponents() {
drawingPanel = new PaintGUI(client).getGlobal();
}
public JTextArea getChatDisplayBox() { public JTextArea getChatDisplayBox() {
return chatDisplayBox; return chatDisplayBox;
} }
public JComboBox getSentMessageToComboBox() { public JComboBox getSendMessageToComboBox()
return sentMessageToComboBox; {
return sendMessageToComboBox;
} }
public JPanel getDrawingPanel() { public JPanel getDrawingPanel() {
...@@ -75,8 +83,18 @@ public class ChatScreen { ...@@ -75,8 +83,18 @@ public class ChatScreen {
try try
{ {
System.out.println("Send button pressed"); System.out.println("Send button pressed");
String toUser = sendMessageToComboBox.getSelectedItem().toString();
if( toUser.equals("All") )
{
chatController.broadcastMessage(client.getUserName(), message); chatController.broadcastMessage(client.getUserName(), message);
} }
else
{
chatController.sendPrivateMessage(client.getUserName(), toUser, message);
}
}
catch (RemoteException ex) catch (RemoteException ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
...@@ -99,20 +117,4 @@ public class ChatScreen { ...@@ -99,20 +117,4 @@ public class ChatScreen {
} }
}; };
public void showGUI() {
frame = new JFrame("Application");
JFrame.setDefaultLookAndFeelDecorated(true);
frame.setContentPane(panel2);
createUIComponents();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setResizable(false);
frame.setVisible(true);
}
private void createUIComponents() {
// PaintGUI paintGUI = new PaintGUI(client);
drawingPanel = new PaintGUI(client).getGlobal();
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment