Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
3
3XA3 Lab 3 Group 7
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mike Li
3XA3 Lab 3 Group 7
Commits
d2d68037
Commit
d2d68037
authored
3 years ago
by
Ahmed Loui Al Koasmh
Browse files
Options
Downloads
Patches
Plain Diff
Added Instructions
parent
8cc6311f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ArrowKeys.png
+0
-0
0 additions, 0 deletions
src/ArrowKeys.png
src/InstructionsDisplay.java
+108
-0
108 additions, 0 deletions
src/InstructionsDisplay.java
src/MainMenuDisplay.java
+17
-0
17 additions, 0 deletions
src/MainMenuDisplay.java
with
125 additions
and
0 deletions
src/ArrowKeys.png
0 → 100644
+
0
−
0
View file @
d2d68037
3.33 KiB
This diff is collapsed.
Click to expand it.
src/InstructionsDisplay.java
0 → 100644
+
108
−
0
View file @
d2d68037
import
java.awt.BorderLayout
;
import
java.awt.EventQueue
;
import
javax.swing.JFrame
;
import
javax.swing.JPanel
;
import
javax.swing.border.EmptyBorder
;
import
java.awt.GridBagLayout
;
import
javax.swing.JLabel
;
import
java.awt.GridBagConstraints
;
import
java.awt.Insets
;
import
javax.swing.SwingConstants
;
import
java.awt.Font
;
import
javax.swing.ImageIcon
;
public
class
InstructionsDisplay
extends
JFrame
{
private
JPanel
contentPane
;
/**
* Launch the application.
*/
/**
* Create the frame.
*/
public
InstructionsDisplay
()
{
setResizable
(
false
);
setTitle
(
"Instructions"
);
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
setBounds
(
100
,
100
,
450
,
300
);
contentPane
=
new
JPanel
();
contentPane
.
setSize
(
900
,
600
);
contentPane
.
setBorder
(
new
EmptyBorder
(
5
,
5
,
5
,
5
));
setSize
(
900
,
600
);
setContentPane
(
contentPane
);
GridBagLayout
gbl_contentPane
=
new
GridBagLayout
();
gbl_contentPane
.
columnWidths
=
new
int
[]{
0
,
0
,
0
,
0
,
0
};
gbl_contentPane
.
rowHeights
=
new
int
[]{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
gbl_contentPane
.
columnWeights
=
new
double
[]{
0.0
,
0.0
,
0.0
,
0.0
,
Double
.
MIN_VALUE
};
gbl_contentPane
.
rowWeights
=
new
double
[]{
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
Double
.
MIN_VALUE
};
contentPane
.
setLayout
(
gbl_contentPane
);
JLabel
lblClickOn
=
new
JLabel
(
"1. Click on \"Play Game\""
);
lblClickOn
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
30
));
GridBagConstraints
gbc_lblClickOn
=
new
GridBagConstraints
();
gbc_lblClickOn
.
insets
=
new
Insets
(
0
,
0
,
5
,
0
);
gbc_lblClickOn
.
gridx
=
3
;
gbc_lblClickOn
.
gridy
=
0
;
contentPane
.
add
(
lblClickOn
,
gbc_lblClickOn
);
JLabel
lblUseThe
=
new
JLabel
(
"2. Use the arrow keys to move the snake"
);
lblUseThe
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
30
));
GridBagConstraints
gbc_lblUseThe
=
new
GridBagConstraints
();
gbc_lblUseThe
.
insets
=
new
Insets
(
0
,
0
,
5
,
0
);
gbc_lblUseThe
.
gridx
=
3
;
gbc_lblUseThe
.
gridy
=
1
;
contentPane
.
add
(
lblUseThe
,
gbc_lblUseThe
);
JLabel
lblNewLabel
=
new
JLabel
(
""
);
lblNewLabel
.
setIcon
(
new
ImageIcon
(
"ArrowKeys.png"
));
GridBagConstraints
gbc_lblNewLabel
=
new
GridBagConstraints
();
gbc_lblNewLabel
.
insets
=
new
Insets
(
0
,
0
,
5
,
0
);
gbc_lblNewLabel
.
gridx
=
3
;
gbc_lblNewLabel
.
gridy
=
2
;
contentPane
.
add
(
lblNewLabel
,
gbc_lblNewLabel
);
JLabel
lblCollectRed
=
new
JLabel
(
"3. Collect red food blocks to increase your score"
);
lblCollectRed
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
30
));
GridBagConstraints
gbc_lblCollectRed
=
new
GridBagConstraints
();
gbc_lblCollectRed
.
insets
=
new
Insets
(
0
,
0
,
5
,
0
);
gbc_lblCollectRed
.
gridx
=
3
;
gbc_lblCollectRed
.
gridy
=
3
;
contentPane
.
add
(
lblCollectRed
,
gbc_lblCollectRed
);
JLabel
lblSelectThe
=
new
JLabel
(
"4. Select the Settings button from the main menu to"
);
lblSelectThe
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
30
));
GridBagConstraints
gbc_lblSelectThe
=
new
GridBagConstraints
();
gbc_lblSelectThe
.
insets
=
new
Insets
(
0
,
0
,
5
,
0
);
gbc_lblSelectThe
.
gridx
=
3
;
gbc_lblSelectThe
.
gridy
=
4
;
contentPane
.
add
(
lblSelectThe
,
gbc_lblSelectThe
);
JLabel
lblCustomizeGameProperties
=
new
JLabel
(
"customize game properties"
);
lblCustomizeGameProperties
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
30
));
GridBagConstraints
gbc_lblCustomizeGameProperties
=
new
GridBagConstraints
();
gbc_lblCustomizeGameProperties
.
insets
=
new
Insets
(
0
,
0
,
5
,
0
);
gbc_lblCustomizeGameProperties
.
gridx
=
3
;
gbc_lblCustomizeGameProperties
.
gridy
=
5
;
contentPane
.
add
(
lblCustomizeGameProperties
,
gbc_lblCustomizeGameProperties
);
JLabel
lblSelectThe_1
=
new
JLabel
(
"5. Select the High Scores button to see your top 10 high scores"
);
lblSelectThe_1
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
30
));
GridBagConstraints
gbc_lblSelectThe_1
=
new
GridBagConstraints
();
gbc_lblSelectThe_1
.
insets
=
new
Insets
(
0
,
0
,
5
,
0
);
gbc_lblSelectThe_1
.
gridx
=
3
;
gbc_lblSelectThe_1
.
gridy
=
6
;
contentPane
.
add
(
lblSelectThe_1
,
gbc_lblSelectThe_1
);
JLabel
lblHaveFun
=
new
JLabel
(
"Have Fun! :)"
);
lblHaveFun
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
35
));
GridBagConstraints
gbc_lblHaveFun
=
new
GridBagConstraints
();
gbc_lblHaveFun
.
insets
=
new
Insets
(
0
,
0
,
5
,
0
);
gbc_lblHaveFun
.
gridx
=
3
;
gbc_lblHaveFun
.
gridy
=
10
;
contentPane
.
add
(
lblHaveFun
,
gbc_lblHaveFun
);
}
}
This diff is collapsed.
Click to expand it.
src/MainMenuDisplay.java
+
17
−
0
View file @
d2d68037
...
...
@@ -228,6 +228,23 @@ public class MainMenuDisplay extends JFrame {
btnNewButton
.
setBounds
(
692
,
21
,
128
,
44
);
contentPane
.
add
(
btnNewButton
);
JButton
btnInstructions
=
new
JButton
(
"Instructions"
);
btnInstructions
.
setFont
(
new
Font
(
"TimesRoman"
,
Font
.
PLAIN
,
20
));
btnInstructions
.
setBackground
(
new
Color
(
145
,
139
,
139
));
btnInstructions
.
setForeground
(
Color
.
WHITE
);
btnInstructions
.
setFocusPainted
(
false
);
btnInstructions
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseClicked
(
MouseEvent
arg0
)
{
InstructionsDisplay
panel
=
new
InstructionsDisplay
();
panel
.
setVisible
(
true
);
}
});
btnInstructions
.
setBounds
(
40
,
21
,
128
,
44
);
contentPane
.
add
(
btnInstructions
);
JLabel
newImage
=
new
JLabel
(
new
ImageIcon
(
"MainMenuBackground.png"
));
contentPane
.
add
(
newImage
);
newImage
.
setBounds
(-
100
,
0
,
1300
,
600
);
...
...
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