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
f2299652
Commit
f2299652
authored
3 years ago
by
Ahmed Loui Al Koasmh
Browse files
Options
Downloads
Patches
Plain Diff
Added End Game JPanel
parent
23af832f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/EndGameDisplay.java
+61
-50
61 additions, 50 deletions
src/EndGameDisplay.java
with
61 additions
and
50 deletions
src/EndGameDisplay.java
+
61
−
50
View file @
f2299652
import
java.awt.BorderLayout
;
import
java.awt.EventQueue
;
import
java.awt.Font
;
import
javax.swing.JFrame
;
import
javax.swing.JLabel
;
import
javax.swing.JPanel
;
import
javax.swing.border.EmptyBorder
;
import
java.awt.Color
;
import
javax.swing.JButton
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
public
class
EndGameDisplay
extends
JFrame
{
private
static
final
long
serialVersionUID
=
1L
;
private
JPanel
contentPane
;
public
EndGameDisplay
()
{
//ADD CODE FOR END GAME SCREEN
setTitle
(
"GAME OVER"
);
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
setBounds
(
100
,
100
,
900
,
600
);
contentPane
=
new
JPanel
();
contentPane
.
setBackground
(
new
Color
(
0
,
0
,
0
));
contentPane
.
setBorder
(
new
EmptyBorder
(
5
,
5
,
5
,
5
));
setContentPane
(
contentPane
);
contentPane
.
setLayout
(
null
);
JLabel
lblSnakeRevamped
=
new
JLabel
(
"GAME OVER"
);
lblSnakeRevamped
.
setForeground
(
new
Color
(
255
,
0
,
0
));
lblSnakeRevamped
.
setFont
(
new
Font
(
"GOST Common"
,
Font
.
BOLD
,
87
));
lblSnakeRevamped
.
setBounds
(
200
,
125
,
501
,
151
);
contentPane
.
add
(
lblSnakeRevamped
);
JButton
btnPlayAgain
=
new
JButton
(
"Play Again!"
);
btnPlayAgain
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
32
));
btnPlayAgain
.
setBounds
(
211
,
297
,
202
,
79
);
contentPane
.
add
(
btnPlayAgain
);
JButton
btnEndGame
=
new
JButton
(
"High Scores"
);
btnEndGame
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
32
));
btnEndGame
.
setBounds
(
443
,
297
,
202
,
79
);
contentPane
.
add
(
btnEndGame
);
}
}
import
java.awt.BorderLayout
;
import
java.awt.EventQueue
;
import
java.awt.Font
;
import
javax.swing.JFrame
;
import
javax.swing.JLabel
;
import
javax.swing.JPanel
;
import
javax.swing.border.EmptyBorder
;
import
java.awt.Color
;
import
javax.swing.JButton
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
public
class
EndGameDisplay
extends
JPanel
{
private
static
final
long
serialVersionUID
=
1L
;
public
static
boolean
goMenu
=
false
;
public
static
boolean
playAgain
=
false
;
public
EndGameDisplay
()
{
//ADD CODE FOR END GAME SCREEN
setSize
(
900
,
600
);
this
.
setBackground
(
new
Color
(
139
,
181
,
181
));
this
.
setBorder
(
new
EmptyBorder
(
5
,
5
,
5
,
5
));
this
.
setLayout
(
null
);
JLabel
lblSnakeRevamped
=
new
JLabel
(
"GAME OVER"
);
lblSnakeRevamped
.
setForeground
(
new
Color
(
255
,
0
,
0
));
lblSnakeRevamped
.
setFont
(
new
Font
(
"GOST Common"
,
Font
.
BOLD
,
87
));
lblSnakeRevamped
.
setBounds
(
200
,
125
,
501
,
151
);
this
.
add
(
lblSnakeRevamped
);
JButton
btnPlayAgain
=
new
JButton
(
"Play Again!"
);
btnPlayAgain
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
32
));
btnPlayAgain
.
setBounds
(
211
,
297
,
202
,
79
);
btnPlayAgain
.
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
arg0
)
{
playAgain
=
true
;
}
});
this
.
add
(
btnPlayAgain
);
JButton
btnEndGame
=
new
JButton
(
"Main Menu"
);
btnEndGame
.
setFont
(
new
Font
(
"Tahoma"
,
Font
.
PLAIN
,
32
));
btnEndGame
.
setBounds
(
443
,
297
,
202
,
79
);
btnEndGame
.
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
arg0
)
{
goMenu
=
true
;
}
});
this
.
add
(
btnEndGame
);
}
}
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