summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDor Bivas <dor1_b@walla.com>2013-11-30 19:11:23 +0200
committerDor Bivas <dor1_b@walla.com>2013-11-30 19:11:48 +0200
commitad5ae2ef8bc7a37050e79b20358334e6a52d6d68 (patch)
tree0ca5acfa6e770439f2eb66110b0eefef88cb0983 /src
parent666377971c25f19f4114632c1adc0ff7d5b17e99 (diff)
improve
Diffstat (limited to 'src')
-rw-r--r--src/Client/SwingTest.java81
1 files changed, 68 insertions, 13 deletions
diff --git a/src/Client/SwingTest.java b/src/Client/SwingTest.java
index 15d5fc0..bd7d2b4 100644
--- a/src/Client/SwingTest.java
+++ b/src/Client/SwingTest.java
@@ -1,30 +1,85 @@
package Client;
import java.awt.Color;
-import java.util.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.xml.soap.Text;
-public class SwingTest extends JFrame
+public class SwingTest extends JFrame implements ActionListener
{
- public static Scanner reader = new Scanner(System.in);
+ private JTextField message;
+ private JTextArea output;
public static void main(String args[])
{
new SwingTest();
-
-
}
SwingTest()
{
-
this.setIconImage(getIconImage());
- this.setSize(500, 100);
- System.out.println("Enter Your massge here :");
- String st = reader.nextLine();
- Color Red = new Color(ABORT);
- JLabel Test = new JLabel(st);
- add(Test);
- this.setBackground(getForeground());
+ this.setSize(800, 400);
+
+ output = new JTextArea(10, 20);
+ output.setBackground(Color.blue);
+
+ JPanel msgPanel = new JPanel();
+ JPanel conPanel = new JPanel();
+ JPanel vertPanel = new JPanel();
+
+ 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");
+ send.setActionCommand("send");
+ send.addActionListener(this);
+ send.setToolTipText("Click this button to send message");
+
+ vertPanel.setLayout(new BoxLayout(vertPanel, BoxLayout.PAGE_AXIS));
+
+ msgPanel.add(send);
+ msgPanel.add(new JLabel("Message:"));
+ msgPanel.add(message);
+ msgPanel.add(stop);
+
+ conPanel.add(new JLabel("host:"));
+ conPanel.add(new JTextField("localhost", 15));
+ conPanel.add(new JLabel("port:"));
+ conPanel.add(new JTextField("6667", 4));
+
+ vertPanel.add(output);
+ vertPanel.add(conPanel);
+ vertPanel.add(msgPanel);
+
+ add(vertPanel);
+
setVisible(true);
}
+
+ public void actionPerformed(ActionEvent e)
+ {
+ System.out.println(e.getActionCommand()); //FIXME: delete.
+ String command = e.getActionCommand();
+
+ if (command == "stop")
+ {
+ System.exit(0);
+ }
+
+ if (command == "send")
+ {
+ System.out.println(message.getText());
+ output.append(message.getText() + "\n");
+ message.setText("");
+ }
+ }
}