-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatting_room.java
More file actions
89 lines (56 loc) · 1.69 KB
/
chatting_room.java
File metadata and controls
89 lines (56 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Panel;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class message extends JFrame{
String serverAddress;
Scanner in;
PrintWriter out;
JPanel p;
JPanel p1;
JPanel p2;
JFrame frame = new JFrame("Chatter");
// JTextField textField ;//Declare Textfield
// JTextArea messageArea ;//Declare message area
JTextField tf = new JTextField(20);
JTextArea ta = new JTextArea(7, 20);
JButton fileBtn= new JButton("파일");
public void messagePanel() {
// TODO Auto-generated method stub
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
c.add(new JScrollPane(ta));
c.add(tf);
c.add(fileBtn);
tf.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTextField t = (JTextField)e.getSource();
ta.append(t.getText() + "\n");
t.setText("");
}
});
setSize(300,300);
setVisible(true);
frame.setLocation(300,100);
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}