Skip to content
Snippets Groups Projects
Commit f2299652 authored by Ahmed Loui Al Koasmh's avatar Ahmed Loui Al Koasmh
Browse files

Added End Game JPanel

parent 23af832f
No related branches found
No related tags found
No related merge requests found
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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment