Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
lab 10
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9731065
lab 10
Commits
ecfc3940
Commit
ecfc3940
authored
May 21, 2019
by
9731065
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2 classes created
parent
ccbfcac2
Pipeline
#650
canceled with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
1 deletion
+46
-1
ChatArea.java
src/ChatArea.java
+18
-0
ChatRoomGUI.java
src/ChatRoomGUI.java
+28
-1
No files found.
src/ChatArea.java
0 → 100644
View file @
ecfc3940
import
javax.swing.*
;
import
java.awt.*
;
public
class
ChatArea
extends
JTextArea
{
private
static
final
int
ROWS
=
10
,
COLUMNS
=
30
;
public
ChatArea
()
{
super
(
ROWS
,
COLUMNS
);
this
.
setEditable
(
false
);
this
.
setLineWrap
(
true
);
this
.
setBackground
(
Color
.
pink
);
}
public
void
addMessage
(
String
username
,
String
userPost
){
setLayout
(
new
BorderLayout
());
insert
(
" "
+
username
+
" _"
+
userPost
,
0
);
}
}
src/ChatRoomGUI.java
View file @
ecfc3940
public
class
ChatRoomGUI
{
import
javax.swing.*
;
import
java.awt.*
;
public
class
ChatRoomGUI
extends
JFrame
{
private
final
String
WINDOWS_TITLE
=
"Aut Chat Room"
;
private
final
int
WIDTH
=
500
,
HEIGHT
=
500
;
private
final
int
X
=
100
,
Y
=
100
;
private
MessageArea
messageArea
;
private
ChatArea
chatBox
;
private
ParticipantsArea
participantsArea
;
public
ChatRoomGUI
(){
super
();
this
.
setTitle
(
WINDOWS_TITLE
);
this
.
setLayout
(
new
BorderLayout
());
ChatArea
chatBox
=
new
ChatArea
();
this
.
add
(
new
JScrollPane
(
chatBox
),
BorderLayout
.
CENTER
);
MessageArea
messageArea
=
new
MessageArea
();
this
.
add
(
messageArea
,
BorderLayout
.
SOUTH
);
participantsArea
=
new
ParticipantsArea
();
this
.
add
(
participantsArea
,
BorderLayout
.
WEST
);
this
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
this
.
setSize
(
WIDTH
,
HEIGHT
);
this
.
setLocation
(
X
,
Y
);
this
.
setVisible
(
true
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment