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

Added Instructions

parent 8cc6311f
No related branches found
No related tags found
No related merge requests found
src/ArrowKeys.png

3.33 KiB

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);
}
}
......@@ -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);
......
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