Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
Lab10
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
9731087
Lab10
Commits
bee67334
Commit
bee67334
authored
May 19, 2019
by
9731087
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
class created
parent
5bf65cc2
Pipeline
#630
canceled with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
5 deletions
+73
-5
ChatArea.java
src/ChatArea.java
+15
-1
ChatRoomGUI.java
src/ChatRoomGUI.java
+22
-1
Main.java
src/Main.java
+4
-1
ParticipantsArea.java
src/ParticipantsArea.java
+9
-0
UsernameFrame.java
src/UsernameFrame.java
+23
-2
No files found.
src/ChatArea.java
View file @
bee67334
public
class
ChatArea
{
import
javax.swing.*
;
public
class
ChatArea
extends
JTextArea
{
private
static
final
int
ROWS
=
10
,
COLUMNS
=
30
;
public
ChatArea
()
{
super
(
ROWS
,
COLUMNS
);
this
.
setEditable
(
false
);
this
.
setLineWrap
(
true
);
}
public
void
addMessage
(
String
username
,
String
message
)
{
String
sb1
=
username
+
": "
+
message
;
append
(
sb1
);
}
}
}
src/ChatRoomGUI.java
View file @
bee67334
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
;
public
ChatRoomGUI
()
{
super
();
this
.
setTitle
(
WINDOWS_TITLE
);
this
.
setLayout
(
null
);
this
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
this
.
setSize
(
WIDTH
,
HEIGHT
);
this
.
setLocation
(
X
,
Y
);
this
.
setVisible
(
true
);
ChatArea
chatBox
=
new
ChatArea
();
this
.
add
(
new
JScrollPane
(
chatBox
),
BorderLayout
.
CENTER
);
}
}
}
src/Main.java
View file @
bee67334
public
class
Main
{
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Hello World!"
);
//System.out.println("Hello World!");
//UsernameFrame usernameFrame = new UsernameFrame();
ChatRoomGUI
chatRoomGUI
=
new
ChatRoomGUI
();
}
}
}
}
src/ParticipantsArea.java
View file @
bee67334
public
class
ParticipantsArea
{
public
class
ParticipantsArea
{
public
void
addNewParticipant
(
String
username
)
{
}
public
void
removeParticipant
(
String
username
)
{
}
}
}
src/UsernameFrame.java
View file @
bee67334
public
class
UsernameFrame
{
import
javax.swing.*
;
}
import
java.awt.*
;
public
class
UsernameFrame
extends
JFrame
{
private
static
final
String
BTN_TXT
=
" Start Chatting ..."
;
private
static
final
String
LABEL_TXT
=
" Choose Your UserName "
;
private
static
final
int
WIDTH
=
300
,
HEIGHT
=
100
;
JTextField
textField
;
JButton
btn
;
public
UsernameFrame
()
throws
HeadlessException
{
super
();
this
.
setLayout
(
new
BorderLayout
());
JLabel
label
=
new
JLabel
(
"Choose Your UserName"
);
add
(
label
,
BorderLayout
.
PAGE_START
);
textField
=
new
JTextField
();
add
(
textField
,
BorderLayout
.
CENTER
);
btn
=
new
JButton
(
LABEL_TXT
);
add
(
btn
,
BorderLayout
.
PAGE_END
);
setSize
(
WIDTH
,
HEIGHT
);
setVisible
(
true
);
}
}
\ No newline at end of file
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