Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
COMP90015-DSAss2-InfinityMonkeys-remaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ho Dac Hai
COMP90015-DSAss2-InfinityMonkeys-remaster
Commits
4f8b919a
Commit
4f8b919a
authored
Oct 23, 2019
by
Hai HoDac
Browse files
Options
Downloads
Patches
Plain Diff
update startScreen
parent
ad7174e1
No related branches found
No related tags found
1 merge request
!35
update startScreen
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/GUI/StartScreen.form
+21
-21
21 additions, 21 deletions
src/GUI/StartScreen.form
src/GUI/StartScreen.java
+32
-5
32 additions, 5 deletions
src/GUI/StartScreen.java
with
53 additions
and
26 deletions
src/GUI/StartScreen.form
+
21
−
21
View file @
4f8b919a
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
</constraints>
</constraints>
<properties>
<properties>
<editable
value=
"false"
/>
<editable
value=
"false"
/>
<text
value=
"
Welcome to Distributed Whiteboard.
Please provide
server's IP,
username
,
and password."
/>
<text
value=
"Please provide
your
username and password
, as well as server's IP to start
."
/>
</properties>
</properties>
</component>
</component>
</children>
</children>
...
@@ -74,17 +74,22 @@
...
@@ -74,17 +74,22 @@
</properties>
</properties>
<border
type=
"none"
title=
" "
/>
<border
type=
"none"
title=
" "
/>
<children>
<children>
<vspacer
id=
"bb71b"
>
<constraints>
<grid
row=
"0"
column=
"2"
row-span=
"1"
col-span=
"1"
vsize-policy=
"6"
hsize-policy=
"1"
anchor=
"0"
fill=
"2"
indent=
"0"
use-parent-layout=
"false"
/>
</constraints>
</vspacer>
<component
id=
"94078"
class=
"javax.swing.JLabel"
>
<component
id=
"94078"
class=
"javax.swing.JLabel"
>
<constraints>
<constraints>
<grid
row=
"
0
"
column=
"0"
row-span=
"1"
col-span=
"2"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"0"
indent=
"0"
use-parent-layout=
"false"
/>
<grid
row=
"
2
"
column=
"0"
row-span=
"1"
col-span=
"2"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"0"
indent=
"0"
use-parent-layout=
"false"
/>
</constraints>
</constraints>
<properties>
<properties>
<text
value=
"Server IP:"
/>
<text
value=
"Server IP:"
/>
</properties>
</properties>
</component>
</component>
<component
id=
"63209"
class=
"javax.swing.JTextField"
binding=
"
text
Field
2
"
>
<component
id=
"63209"
class=
"javax.swing.JTextField"
binding=
"
server
Field"
>
<constraints>
<constraints>
<grid
row=
"
1
"
column=
"0"
row-span=
"1"
col-span=
"2"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
indent=
"0"
use-parent-layout=
"false"
>
<grid
row=
"
3
"
column=
"0"
row-span=
"1"
col-span=
"2"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
indent=
"0"
use-parent-layout=
"false"
>
<preferred-size
width=
"150"
height=
"-1"
/>
<preferred-size
width=
"150"
height=
"-1"
/>
</grid>
</grid>
</constraints>
</constraints>
...
@@ -92,43 +97,38 @@
...
@@ -92,43 +97,38 @@
<text
value=
""
/>
<text
value=
""
/>
</properties>
</properties>
</component>
</component>
<vspacer
id=
"bb71b"
>
<constraints>
<grid
row=
"0"
column=
"2"
row-span=
"1"
col-span=
"1"
vsize-policy=
"6"
hsize-policy=
"1"
anchor=
"0"
fill=
"2"
indent=
"0"
use-parent-layout=
"false"
/>
</constraints>
</vspacer>
<component
id=
"87b91"
class=
"javax.swing.JLabel"
>
<component
id=
"87b91"
class=
"javax.swing.JLabel"
>
<constraints>
<constraints>
<grid
row=
"0"
column=
"
3
"
row-span=
"1"
col-span=
"1"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"0"
indent=
"0"
use-parent-layout=
"false"
/>
<grid
row=
"0"
column=
"
0
"
row-span=
"1"
col-span=
"1"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"0"
indent=
"0"
use-parent-layout=
"false"
/>
</constraints>
</constraints>
<properties>
<properties>
<text
value=
"
Your
name:"
/>
<text
value=
"
User
name:"
/>
</properties>
</properties>
</component>
</component>
<component
id=
"e39f4"
class=
"javax.swing.JTextField"
binding=
"
textField1"
default-binding=
"true
"
>
<component
id=
"e39f4"
class=
"javax.swing.JTextField"
binding=
"
usernameField
"
>
<constraints>
<constraints>
<grid
row=
"1"
column=
"
3
"
row-span=
"1"
col-span=
"
1
"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
indent=
"0"
use-parent-layout=
"false"
>
<grid
row=
"1"
column=
"
0
"
row-span=
"1"
col-span=
"
2
"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
indent=
"0"
use-parent-layout=
"false"
>
<preferred-size
width=
"150"
height=
"-1"
/>
<preferred-size
width=
"150"
height=
"-1"
/>
</grid>
</grid>
</constraints>
</constraints>
<properties/>
<properties/>
</component>
</component>
<component
id=
"
51d9f
"
class=
"javax.swing.J
PasswordField"
binding=
"passwordFi
el
d
"
>
<component
id=
"
62e48
"
class=
"javax.swing.J
Lab
el"
>
<constraints>
<constraints>
<grid
row=
"3"
column=
"0"
row-span=
"1"
col-span=
"2"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
indent=
"0"
use-parent-layout=
"false"
>
<grid
row=
"0"
column=
"3"
row-span=
"1"
col-span=
"1"
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"8"
fill=
"0"
indent=
"0"
use-parent-layout=
"false"
/>
<preferred-size
width=
"150"
height=
"-1"
/>
</grid>
</constraints>
</constraints>
<properties>
<properties>
<
columns
value=
"
20
"
/>
<
text
value=
"
Password:
"
/>
</properties>
</properties>
</component>
</component>
<component
id=
"
62e48
"
class=
"javax.swing.J
Lab
el"
>
<component
id=
"
51d9f
"
class=
"javax.swing.J
PasswordField"
binding=
"passwordFi
el
d
"
>
<constraints>
<constraints>
<grid
row=
"2"
column=
"0"
row-span=
"1"
col-span=
"1"
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"8"
fill=
"0"
indent=
"0"
use-parent-layout=
"false"
/>
<grid
row=
"1"
column=
"3"
row-span=
"1"
col-span=
"1"
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
indent=
"0"
use-parent-layout=
"false"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</grid>
</constraints>
</constraints>
<properties>
<properties>
<
text
value=
"
Password:
"
/>
<
columns
value=
"
20
"
/>
</properties>
</properties>
</component>
</component>
</children>
</children>
...
...
This diff is collapsed.
Click to expand it.
src/GUI/StartScreen.java
+
32
−
5
View file @
4f8b919a
...
@@ -2,17 +2,21 @@ package GUI;
...
@@ -2,17 +2,21 @@ package GUI;
import
client.Client
;
import
client.Client
;
import
javax.imageio.ImageIO
;
import
javax.swing.*
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.ActionListener
;
import
java.io.File
;
import
java.io.IOException
;
public
class
StartScreen
{
public
class
StartScreen
{
private
JTextPane
information
;
private
JTextPane
information
;
private
JPanel
panel1
;
private
JPanel
panel1
;
private
JTextField
text
Field
1
;
private
JTextField
username
Field
;
private
JButton
joinButton
;
private
JButton
joinButton
;
private
JTextField
text
Field
2
;
private
JTextField
server
Field
;
private
JTextField
textField3
;
private
JTextField
textField3
;
private
JPasswordField
passwordField
;
private
JPasswordField
passwordField
;
JFrame
frame
;
JFrame
frame
;
...
@@ -35,8 +39,8 @@ public class StartScreen {
...
@@ -35,8 +39,8 @@ public class StartScreen {
{
{
if
(
e
.
getSource
()
==
joinButton
)
if
(
e
.
getSource
()
==
joinButton
)
{
{
String
serverAddress
=
text
Field
2
.
getText
();
String
serverAddress
=
server
Field
.
getText
();
String
userName
=
text
Field
1
.
getText
();
String
userName
=
username
Field
.
getText
();
String
password
=
new
String
(
passwordField
.
getPassword
());
String
password
=
new
String
(
passwordField
.
getPassword
());
int
connectionStatus
=
client
.
connect
(
userName
,
serverAddress
,
password
);
int
connectionStatus
=
client
.
connect
(
userName
,
serverAddress
,
password
);
...
@@ -49,7 +53,7 @@ public class StartScreen {
...
@@ -49,7 +53,7 @@ public class StartScreen {
}
}
else
if
(
connectionStatus
==
2
)
else
if
(
connectionStatus
==
2
)
{
{
showErrorMessage
(
"Duplicate username: Please enter a new username"
);
showErrorMessage
(
"Duplicate username
Field
: Please enter a new username
Field
"
);
}
}
else
if
(
connectionStatus
==
3
)
else
if
(
connectionStatus
==
3
)
{
{
...
@@ -84,6 +88,29 @@ public class StartScreen {
...
@@ -84,6 +88,29 @@ public class StartScreen {
frame
.
setLocationRelativeTo
(
null
);
frame
.
setLocationRelativeTo
(
null
);
frame
.
getRootPane
().
setDefaultButton
(
joinButton
);
frame
.
getRootPane
().
setDefaultButton
(
joinButton
);
joinButton
.
requestFocus
();
joinButton
.
requestFocus
();
//frame.getContentPane().add(new JPanelWithBackground("sample.jpeg"));
frame
.
setVisible
(
true
);
frame
.
setVisible
(
true
);
}
}
// public class JPanelWithBackground extends JPanel
// {
//
// private Image backgroundImage;
//
// // Some code to initialize the background image.
// // Here, we use the constructor to load the image. This
// // can vary depending on the use case of the panel.
// public JPanelWithBackground(String fileName) throws IOException
// {
// backgroundImage = ImageIO.read(new File(fileName));
// }
//
// public void paintComponent(Graphics g) {
// super.paintComponent(g);
//
// // Draw the background image.
// g.drawImage(backgroundImage, 0, 0, this);
// }
// }
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment