summaryrefslogtreecommitdiff
path: root/src/Client/UserInterface.java
diff options
context:
space:
mode:
authorDor Bivas <dor1_b@walla.com>2013-12-02 01:00:11 +0200
committerDor Bivas <dor1_b@walla.com>2013-12-02 01:00:11 +0200
commit37581261da89d2d720af2f213eea3211589d2645 (patch)
tree00c4a997d934a0df9a6e0024a54778fe4b0e7259 /src/Client/UserInterface.java
parentc7876de55daeb34fb7f997aedcd30ce2b36c400d (diff)
Full connection to the client
Diffstat (limited to 'src/Client/UserInterface.java')
-rw-r--r--src/Client/UserInterface.java36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/Client/UserInterface.java b/src/Client/UserInterface.java
index 1bf659e..a354e97 100644
--- a/src/Client/UserInterface.java
+++ b/src/Client/UserInterface.java
@@ -16,16 +16,15 @@ public class UserInterface extends JFrame implements ActionListener
{
private JTextField message;
private JTextArea output;
-
- /** Running graphic interface */
- public static void main(String args[])
- {
- new UserInterface();
- }
+ private ChatClient client;
+ private JTextField host = new JTextField("localhost", 15);
+ private JTextField port = new JTextField("6667", 4);
/** Graphic interface recipient the client*/
- public UserInterface()
+ public UserInterface(ChatClient client)
{
+ this.client = client;
+
this.setIconImage(getIconImage());
this.setSize(800, 400);
@@ -60,11 +59,13 @@ public class UserInterface extends JFrame implements ActionListener
msgPanel.add(message);
msgPanel.add(stop);
+
+
conPanel.add(new JLabel("host:"));
- conPanel.add(new JTextField("localhost", 15));
+ conPanel.add(host);
conPanel.add(new JLabel("port:"));
- conPanel.add(new JTextField("6667", 4));
-
+ conPanel.add(port);
+
vertPanel.add(output);
vertPanel.add(conPanel);
vertPanel.add(msgPanel);
@@ -102,15 +103,12 @@ public class UserInterface extends JFrame implements ActionListener
if (command == "connect" && counterClick == 0 )
{
- output.append("You've connect to the server succesufully" + "\n");
- counterClick++;
+ if (client.connect("localhost",(Integer.parseInt("6667"))))
+ {
+ output.append("You've connect to the server succesufully" + "\n");
+ counterClick++;
+ }
}
-
-
-
-// public void run ()
-// {
-//
-// }
+
}
}