Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
jeniferposso
Source-Code-from-Tutorials
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
Source-Code-from-Tutorials
/
Java_Intermediate
/
39_javaIntermediate.java
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
35 lines (32 loc) · 811 Bytes
master
Breadcrumbs
Source-Code-from-Tutorials
/
Java_Intermediate
/
39_javaIntermediate.java
Copy path
Top
File metadata and controls
Code
Blame
35 lines (32 loc) · 811 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
java
.
io
.*;
import
java
.
net
.*;
import
java
.
awt
.*;
import
java
.
awt
.
event
.*;
import
javax
.
swing
.*;
public
class
Server
extends
JFrame
{
private
JTextField
userText
;
private
JTextArea
chatWindow
;
private
ObjectOutputStream
output
;
private
ObjectInputStream
input
;
private
ServerSocket
server
;
private
Socket
connection
;
//constructor
public
Server
(){
super
(
"Buckys Instant Messenger"
);
userText
=
new
JTextField
();
userText
.
setEditable
(
false
);
userText
.
addActionListener
(
new
ActionListener
(){
public
void
actionPerformed
(
ActionEvent
event
){
sendMessage
(
event
.
getActionCommand
());
userText
.
setText
(
""
);
}
}
);
add
(
userText
,
BorderLayout
.
NORTH
);
chatWindow
=
new
JTextArea
();
add
(
new
JScrollPane
(
chatWindow
));
setSize
(
300
,
150
);
setVisible
(
true
);
}
}
You can’t perform that action at this time.