Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mathfacts.views;
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import javax.swing.JLabel;
- import javax.swing.SwingConstants;
- import javax.swing.UIManager;
- import java.awt.Font;
- import javax.swing.JButton;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- public class GameOver extends JFrame {
- private JPanel cPane;
- private JLabel lblGameOver;
- private JButton btnRetry;
- private static GameOver frame;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- try {
- UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
- } catch (Throwable e) {
- e.printStackTrace();
- }
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- frame = new GameOver();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public GameOver() {
- initComponents();
- createEvents();
- }
- private void initComponents() {
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 585, 700);
- cPane = new JPanel();
- cPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- cPane.setLayout(new BorderLayout(0, 0));
- setContentPane(cPane);
- cPane.setBackground(Color.BLACK);
- lblGameOver = new JLabel("GAME OVER");
- lblGameOver.setFont(new Font("Tahoma", Font.PLAIN, 99));
- lblGameOver.setHorizontalAlignment(SwingConstants.CENTER);
- lblGameOver.setForeground(Color.WHITE);
- cPane.add(lblGameOver, BorderLayout.CENTER);
- btnRetry = new JButton("RETRY");
- btnRetry.setFont(new Font("Tahoma", Font.PLAIN, 99));
- cPane.add(btnRetry, BorderLayout.SOUTH);
- }
- private void createEvents() {
- btnRetry.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- new Game().setVisible(true);
- dispose();
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement