summaryrefslogtreecommitdiff
path: root/src/Client/UserInterface.java
diff options
context:
space:
mode:
authorDor Bivas <dor1_b@walla.com>2013-12-11 16:27:03 +0200
committerDor Bivas <dor1_b@walla.com>2013-12-11 16:29:22 +0200
commitc35cc0aa84ba0f17f0aba07e0b1358dc2545d4f1 (patch)
treead4624c5ff19fcfeaf9796f7454f3e7d96a33c32 /src/Client/UserInterface.java
parente289f6ea8d3e5e6e548f979890bb0e5593d4b593 (diff)
client tasks 4-7
Diffstat (limited to 'src/Client/UserInterface.java')
-rw-r--r--src/Client/UserInterface.java37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/Client/UserInterface.java b/src/Client/UserInterface.java
index 0580e3b..02abbfd 100644
--- a/src/Client/UserInterface.java
+++ b/src/Client/UserInterface.java
@@ -2,6 +2,7 @@ package Client;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.net.Socket;
import javax.swing.AbstractButton;
import javax.swing.BoxLayout;
@@ -9,6 +10,7 @@ import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.xml.soap.Text;
@@ -23,6 +25,7 @@ public class UserInterface extends JFrame implements ActionListener
private JTextField host = new JTextField("localhost", 15);
private JTextField port = new JTextField("6667", 4);
private JButton connect;
+ private JButton send;
public void outputWriter (String line)
@@ -46,13 +49,16 @@ public class UserInterface extends JFrame implements ActionListener
JPanel conPanel = new JPanel();
JPanel vertPanel = new JPanel();
+ JTextArea feedbackText = new JTextArea();
+ JScrollPane scrollText = new JScrollPane(feedbackText);
+
message = new JTextField(40);
JButton stop = new JButton("Stop");
stop.setActionCommand("stop");
stop.addActionListener(this);
stop.setToolTipText("Click this button to exit.");
- JButton send = new JButton("Send");
+ this.send = new JButton("Send");
send.setActionCommand("send");
send.addActionListener(this);
send.setToolTipText("Click this button to send message.");
@@ -61,6 +67,7 @@ public class UserInterface extends JFrame implements ActionListener
connect.setActionCommand("connect");
connect.addActionListener(this);
connect.setToolTipText("Click this button to connect the server.");
+ this.send.setEnabled(false);
vertPanel.setLayout(new BoxLayout(vertPanel, BoxLayout.PAGE_AXIS));
@@ -75,6 +82,8 @@ public class UserInterface extends JFrame implements ActionListener
conPanel.add(new JLabel("port:"));
conPanel.add(port);
+ conPanel.add(scrollText);
+
vertPanel.add(output);
vertPanel.add(conPanel);
vertPanel.add(msgPanel);
@@ -87,6 +96,7 @@ public class UserInterface extends JFrame implements ActionListener
int counterClick = 0;
+
/** Syncing the the action that the button send to the perform
* @param name of the action */
public void actionPerformed(ActionEvent e)
@@ -98,8 +108,28 @@ public class UserInterface extends JFrame implements ActionListener
{
System.exit(0);
}
-
- if (command == "send")
+
+// if (e.getSource() == 'escape')
+// {
+// System.exit(0);
+// }
+//
+// if (e.getSource() == 'ALT' + 'F4')
+// {
+// System.exit(0);
+// }
+//
+//
+// if (e.getSource() == 'enter')
+// {
+// output.append(message.getText() + "\n");
+// client.PRIVMSG(message.getText());
+// message.setText("");
+// }
+
+
+
+ if (command == "send" )
{
output.append(message.getText() + "\n");
client.PRIVMSG(message.getText());
@@ -113,6 +143,7 @@ public class UserInterface extends JFrame implements ActionListener
{
output.append("You've connect to the server succesufully" + "\n");
counterClick++;
+ this.send.setEnabled(true);
this.connect.setEnabled(false);
}
}