Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

import java.awt.Container; import java.awt.Rectangle; import java.awt.event.Acti

ID: 3706883 • Letter: I

Question

import java.awt.Container; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.*;
public abstract class JPanelFayette extends JPanel implements ActionListener, MouseListener {
Timer Time; int deltay, directiony, direstionY=4;; int deltax, directionx, directionX=2; int startX=2; int StartY=4; int i; int delay=0;
JLabel 11 = new JLabel ("Score"); JLabel 12 = new JLabel ("Timer");
int clicked=0;
ImageIcon Erie = new ImageIcon("Erie.jpg"); ImageIcon UniversityPark = new ImageIcon("UniversityPark.jpg"); ImageIcon WorldCampus = new ImageIcon("WorldCampus.jpg");
JButton Er1 = new JButton (Erie); JButton Up1 = new JButton (UniversityPark); JButton Wc1 = new JButton (WorldCampus); JButton ty = new JButton ("Thank you");
ImageIcon win =new ImageIcon("WinScreen.jpg"); ImageIcon lost =new ImageIcon("LoseScreen.jpg");
JButton w1= new JButton (win); JButton l1= new JButton (lost);
Boolean loser, winner; boolean mouseClicked, mouseEntered= false;
public JPanelFayette (int startX, int startY, int deltaX, int deltaY, int directionY, int delay){
super(); this.deltax= deltaX; this.deltay=deltaY; this.directionX=directionX; this.directionY=directionY;
add(11); add(12); add(Er1); add(Up1); add(Wc1); add(w1); add(l1);
l1.setVisible(false); w1.setVisible(false);
addMouseListener(this); Er1.addActionListener(this); w1.addActionListener(this); l1.addActionaListener(this); Up1.addActionListener(this); Wc1.addActionListener(this);
Er1.setLocation(6,6); Up1.setLocation (4,4); Wc1.setLocation (1,1); ty.setLocation (5,5); Timer time = new Timer (delay, this);
public void actionPerformed(ActionEvent event){
Object obj =event.getSource(); Container student = getStudent(); winner(); loser ();
if (obj== Wc1){ Er1.setVisible(false); Up1.setVisible(false); Er1.setEnabled(false); Up1.setEnabled(false);
remove(Er1); remove(Up1); setSize(300,300); } if (obj==Up1){ Er1.setVisible(false); Wc1.setVisible(false); Er1.setEnabled(false); Wc1.setEnabled(false);
remove(Er1); remove(Wc1); setSize(300,300); } if (obj==Er1){ Up1.setVisible(false); Wc1.setVisible(false); Up1.setEnabled(false); Wc1.setEnabled(false);
remove(Up1); remove(Wc1); setSize(300,300); }
if(clicked<25||winner==false) { nextX = 0; directionX*=-1; } if(nextX+getSize().width>student.getSize().width){ nextX=student.getSize().width-getSize().width; directionX*=-1; }
int nextY= getLocation().y+(deltay*directionY); if(nextY<0){ nextY=0; directionY*=-1; } if(nextY+getSize().height>student.getSize().height){ nectY=studen.getSize().height-getSize().height; directionY*=-1; } setLocation(nextX.nextY); if (obj==Er1||obj==Up1||obj==Wc1){ if(mouseClicked=true){ directionY++; directionX++; clicked++; delay=(10-1); String strI=String.valueOf(clicked); l1.setText(strI); delay--; } } } } @Override public void mouseClicked (MouseEvent e){ mouseClicked=true; mouseEntered=true; } @Override public void mouseEntered (MouseEvent e){ mouseClicked=false; mouseEntered=true; }
@Override public void mouseExited (MouseEvent e) { mouseClicked=false; mouseEntered=false; } @override Public void mousePressed(MOuseEvent e) { mouseClicked=true; mouseEntered=true;
}
@override public void mouseReleased(MouseEvent e) { mouseClicked=false; mouseEntered=true;
w1.setVisible(true); l1.setVisible(false); l2.setvisible(false); Er1.setVisible(false); Up1.setVisible(false); Wc1.setVisible(false); setBounds(new Rectangle(0,0,800,630)); winner=true; loser=false; } public boolean loser() { if (clicked <30){ if((i)>=2000){ l1.setVisible(true); w1.setVisible(false); Er1.setVisible(false); Up1.setVisible(false); Wc1.setVisible(false); l1.setVisible(false); l2.setVisible(false); Wc1.setEnabled(false); Up1.setEnabled(false); Er1.setEnabled(false); remove(Er1); remove(Up1); remove(Wc1); setBounds(new Rectangle(0,0,800,630)); loser=true; winner=false; clicked=0; }

trying to create PSU Shooting arcade game need help please thank you
import java.awt.Container; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.*;
public abstract class JPanelFayette extends JPanel implements ActionListener, MouseListener {
Timer Time; int deltay, directiony, direstionY=4;; int deltax, directionx, directionX=2; int startX=2; int StartY=4; int i; int delay=0;
JLabel 11 = new JLabel ("Score"); JLabel 12 = new JLabel ("Timer");
int clicked=0;
ImageIcon Erie = new ImageIcon("Erie.jpg"); ImageIcon UniversityPark = new ImageIcon("UniversityPark.jpg"); ImageIcon WorldCampus = new ImageIcon("WorldCampus.jpg");
JButton Er1 = new JButton (Erie); JButton Up1 = new JButton (UniversityPark); JButton Wc1 = new JButton (WorldCampus); JButton ty = new JButton ("Thank you");
ImageIcon win =new ImageIcon("WinScreen.jpg"); ImageIcon lost =new ImageIcon("LoseScreen.jpg");
JButton w1= new JButton (win); JButton l1= new JButton (lost);
Boolean loser, winner; boolean mouseClicked, mouseEntered= false;
public JPanelFayette (int startX, int startY, int deltaX, int deltaY, int directionY, int delay){
super(); this.deltax= deltaX; this.deltay=deltaY; this.directionX=directionX; this.directionY=directionY;
add(11); add(12); add(Er1); add(Up1); add(Wc1); add(w1); add(l1);
l1.setVisible(false); w1.setVisible(false);
addMouseListener(this); Er1.addActionListener(this); w1.addActionListener(this); l1.addActionaListener(this); Up1.addActionListener(this); Wc1.addActionListener(this);
Er1.setLocation(6,6); Up1.setLocation (4,4); Wc1.setLocation (1,1); ty.setLocation (5,5); Timer time = new Timer (delay, this);
public void actionPerformed(ActionEvent event){
Object obj =event.getSource(); Container student = getStudent(); winner(); loser ();
if (obj== Wc1){ Er1.setVisible(false); Up1.setVisible(false); Er1.setEnabled(false); Up1.setEnabled(false);
remove(Er1); remove(Up1); setSize(300,300); } if (obj==Up1){ Er1.setVisible(false); Wc1.setVisible(false); Er1.setEnabled(false); Wc1.setEnabled(false);
remove(Er1); remove(Wc1); setSize(300,300); } if (obj==Er1){ Up1.setVisible(false); Wc1.setVisible(false); Up1.setEnabled(false); Wc1.setEnabled(false);
remove(Up1); remove(Wc1); setSize(300,300); }
if(clicked<25||winner==false) { nextX = 0; directionX*=-1; } if(nextX+getSize().width>student.getSize().width){ nextX=student.getSize().width-getSize().width; directionX*=-1; }
int nextY= getLocation().y+(deltay*directionY); if(nextY<0){ nextY=0; directionY*=-1; } if(nextY+getSize().height>student.getSize().height){ nectY=studen.getSize().height-getSize().height; directionY*=-1; } setLocation(nextX.nextY); if (obj==Er1||obj==Up1||obj==Wc1){ if(mouseClicked=true){ directionY++; directionX++; clicked++; delay=(10-1); String strI=String.valueOf(clicked); l1.setText(strI); delay--; } } } } @Override public void mouseClicked (MouseEvent e){ mouseClicked=true; mouseEntered=true; } @Override public void mouseEntered (MouseEvent e){ mouseClicked=false; mouseEntered=true; }
@Override public void mouseExited (MouseEvent e) { mouseClicked=false; mouseEntered=false; } @override Public void mousePressed(MOuseEvent e) { mouseClicked=true; mouseEntered=true;
}
@override public void mouseReleased(MouseEvent e) { mouseClicked=false; mouseEntered=true;
w1.setVisible(true); l1.setVisible(false); l2.setvisible(false); Er1.setVisible(false); Up1.setVisible(false); Wc1.setVisible(false); setBounds(new Rectangle(0,0,800,630)); winner=true; loser=false; } public boolean loser() { if (clicked <30){ if((i)>=2000){ l1.setVisible(true); w1.setVisible(false); Er1.setVisible(false); Up1.setVisible(false); Wc1.setVisible(false); l1.setVisible(false); l2.setVisible(false); Wc1.setEnabled(false); Up1.setEnabled(false); Er1.setEnabled(false); remove(Er1); remove(Up1); remove(Wc1); setBounds(new Rectangle(0,0,800,630)); loser=true; winner=false; clicked=0; }

trying to create PSU Shooting arcade game need help please thank you
import java.awt.Container; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.*;
public abstract class JPanelFayette extends JPanel implements ActionListener, MouseListener {
Timer Time; int deltay, directiony, direstionY=4;; int deltax, directionx, directionX=2; int startX=2; int StartY=4; int i; int delay=0;
JLabel 11 = new JLabel ("Score"); JLabel 12 = new JLabel ("Timer");
int clicked=0;
ImageIcon Erie = new ImageIcon("Erie.jpg"); ImageIcon UniversityPark = new ImageIcon("UniversityPark.jpg"); ImageIcon WorldCampus = new ImageIcon("WorldCampus.jpg");
JButton Er1 = new JButton (Erie); JButton Up1 = new JButton (UniversityPark); JButton Wc1 = new JButton (WorldCampus); JButton ty = new JButton ("Thank you");
ImageIcon win =new ImageIcon("WinScreen.jpg"); ImageIcon lost =new ImageIcon("LoseScreen.jpg");
JButton w1= new JButton (win); JButton l1= new JButton (lost);
Boolean loser, winner; boolean mouseClicked, mouseEntered= false;
public JPanelFayette (int startX, int startY, int deltaX, int deltaY, int directionY, int delay){
super(); this.deltax= deltaX; this.deltay=deltaY; this.directionX=directionX; this.directionY=directionY;
add(11); add(12); add(Er1); add(Up1); add(Wc1); add(w1); add(l1);
l1.setVisible(false); w1.setVisible(false);
addMouseListener(this); Er1.addActionListener(this); w1.addActionListener(this); l1.addActionaListener(this); Up1.addActionListener(this); Wc1.addActionListener(this);
Er1.setLocation(6,6); Up1.setLocation (4,4); Wc1.setLocation (1,1); ty.setLocation (5,5); Timer time = new Timer (delay, this);
public void actionPerformed(ActionEvent event){
Object obj =event.getSource(); Container student = getStudent(); winner(); loser ();
if (obj== Wc1){ Er1.setVisible(false); Up1.setVisible(false); Er1.setEnabled(false); Up1.setEnabled(false);
remove(Er1); remove(Up1); setSize(300,300); } if (obj==Up1){ Er1.setVisible(false); Wc1.setVisible(false); Er1.setEnabled(false); Wc1.setEnabled(false);
remove(Er1); remove(Wc1); setSize(300,300); } if (obj==Er1){ Up1.setVisible(false); Wc1.setVisible(false); Up1.setEnabled(false); Wc1.setEnabled(false);
remove(Up1); remove(Wc1); setSize(300,300); }
if(clicked<25||winner==false) { nextX = 0; directionX*=-1; } if(nextX+getSize().width>student.getSize().width){ nextX=student.getSize().width-getSize().width; directionX*=-1; }
int nextY= getLocation().y+(deltay*directionY); if(nextY<0){ nextY=0; directionY*=-1; } if(nextY+getSize().height>student.getSize().height){ nectY=studen.getSize().height-getSize().height; directionY*=-1; } setLocation(nextX.nextY); if (obj==Er1||obj==Up1||obj==Wc1){ if(mouseClicked=true){ directionY++; directionX++; clicked++; delay=(10-1); String strI=String.valueOf(clicked); l1.setText(strI); delay--; } } } } @Override public void mouseClicked (MouseEvent e){ mouseClicked=true; mouseEntered=true; } @Override public void mouseEntered (MouseEvent e){ mouseClicked=false; mouseEntered=true; }
@Override public void mouseExited (MouseEvent e) { mouseClicked=false; mouseEntered=false; } @override Public void mousePressed(MOuseEvent e) { mouseClicked=true; mouseEntered=true;
}
@override public void mouseReleased(MouseEvent e) { mouseClicked=false; mouseEntered=true;
w1.setVisible(true); l1.setVisible(false); l2.setvisible(false); Er1.setVisible(false); Up1.setVisible(false); Wc1.setVisible(false); setBounds(new Rectangle(0,0,800,630)); winner=true; loser=false; } public boolean loser() { if (clicked <30){ if((i)>=2000){ l1.setVisible(true); w1.setVisible(false); Er1.setVisible(false); Up1.setVisible(false); Wc1.setVisible(false); l1.setVisible(false); l2.setVisible(false); Wc1.setEnabled(false); Up1.setEnabled(false); Er1.setEnabled(false); remove(Er1); remove(Up1); remove(Wc1); setBounds(new Rectangle(0,0,800,630)); loser=true; winner=false; clicked=0; }

trying to create PSU Shooting arcade game need help please thank you

Explanation / Answer

the total program not uploading

u can download total code from my drive link

https://drive.google.com/open?id=1WZhdLLOdMeg10QX-h2qjyY1vqKjI2-g5

public class Game extends JFrame implements ActionListener{

protected static Cursor CURSOR_LOCKED, CURSOR_UNLOCKED, CURSOR_DEFAULT;

private final String fileCursorLocked = "images/cursors/locked.png",

fileCursorUnlocked = "images/cursors/unlocked.png",

fileCursorDefault = "images/cursors/default.png";

protected final static int WIDTH = 900, HEIGHT = 500;

protected final static int REFRESH_TIME = 150;

protected static int highScore = 0;

private final String fileScore =

new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParent() +

File.separator + "__score_data__.txt";

private final String fileCredits = "data/credits.txt";

private Font defaultFont;

private JPanel menuPanel, highScorePanel, creditsPanel;

private JButton playButton, quitButton, creditsButton, highScoreButton,

backButton0, backButton1;

private JTextField txtHighScore;

public enum GameState {NEW, CONTINUE, OVER, HIGHSCORE, CREDITS, WAIT, QUIT};

public static GameState state;

public Game() throws HeadlessException, IOException {

this("SHOOTER GAME");

}

public Game(String title) throws HeadlessException, IOException {

super(title);

initCursors();

loadHighScore();

setBackButtons();

defaultFont = new Font(Font.SERIF, Font.BOLD, 24);

setMenuPanel();

setHighScorePanel();

setCreditsPanel();

setLayout(null);

setPreferredSize(new Dimension(WIDTH, HEIGHT));

setBackground(Color.WHITE);

setDefaultCloseOperation(EXIT_ON_CLOSE);

setResizable(false);

setVisible(true);

pack();

}

private void setBackButtons() {

backButton0 = createButton(new String[] {"images/buttons/back0.png",

"images/buttons/back1.png",

"images/buttons/back2.png"});

backButton1 = createButton(new String[] {"images/buttons/back0.png",

"images/buttons/back1.png",

"images/buttons/back2.png"});

}

public void initCursors() {

Toolkit toolkit = Toolkit.getDefaultToolkit();

Image lockedImage = toolkit.getImage(getClass().getResource(fileCursorLocked));

Image unlockedImage = toolkit.getImage(getClass().getResource(fileCursorUnlocked));

Image menuImage = toolkit.getImage(getClass().getResource(fileCursorDefault));

CURSOR_LOCKED = toolkit.createCustomCursor(lockedImage, new Point(20, 20), "cursorLocked");

CURSOR_UNLOCKED = toolkit.createCustomCursor(unlockedImage, new Point(20, 20), "cursorUnlocked");

CURSOR_DEFAULT = toolkit.createCustomCursor(menuImage, new Point(16, 16), "cursorDefault");

}

public void loadHighScore() throws IOException {

File file = new File(URLDecoder.decode(fileScore, "UTF-8"));

if(!file.canRead()) {

file.createNewFile();

setHighScore(0);

}

else {

BufferedReader reader = new BufferedReader(new FileReader(file));//(new InputStreamReader(getClass().getResourceAsStream(fileScore)));

String line = reader.readLine();

// If file is empty set highScore as 0.

setHighScore( (line != null) ? Integer.parseInt(line) : 0 );

reader.close();

}

}

public static void setState(GameState state) {

Game.state = state;

}

public static void setHighScore(int score) {

if(score < 0)

throw new IllegalArgumentException("High Score CANNOT BE a negative number!");

if(score > highScore)

highScore = score;

}

public static int getHighScore() {

return highScore;

}

public void saveHighScore() throws IOException, SecurityException {

// new File with the file path, it decodes as UTF-8 because there might be some special characters in the file path.

File file = new File(URLDecoder.decode(fileScore, "UTF-8"));

if(!file.canWrite())

file.createNewFile();

BufferedWriter writer = new BufferedWriter(new FileWriter(file));

writer.write(Integer.toString(getHighScore()));

writer.close();

}

public void setMenuPanel() {

menuPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));

menuPanel.setBounds(0, 0, WIDTH, HEIGHT);

menuPanel.setBackground(Color.WHITE);

menuPanel.setCursor(Game.CURSOR_DEFAULT);

JPanel innerPanel = new JPanel(new GridLayout(4, 1, 5, 5));

innerPanel.setPreferredSize(new Dimension(310, 440));

innerPanel.setBackground(Color.WHITE);

playButton = createButton(new String[] {"images/buttons/play0.png",

"images/buttons/play1.png",

"images/buttons/play2.png"});

highScoreButton = createButton(new String[] {"images/buttons/highscore0.png",

"images/buttons/highscore1.png",

"images/buttons/highscore2.png"});

creditsButton = createButton(new String[] {"images/buttons/credits0.png",

"images/buttons/credits1.png",

"images/buttons/credits2.png"});

quitButton = createButton(new String[] {"images/buttons/quit0.png",

"images/buttons/quit1.png",

"images/buttons/quit2.png"});

innerPanel.add(playButton);

innerPanel.add(highScoreButton);

innerPanel.add(creditsButton);

innerPanel.add(quitButton);

menuPanel.add(innerPanel);

}

public void setHighScorePanel() {

highScorePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));

highScorePanel.setBounds(0, 0, WIDTH, HEIGHT);

highScorePanel.setBackground(Color.WHITE);

highScorePanel.setCursor(Game.CURSOR_DEFAULT);

JPanel innerPanel = new JPanel(new GridLayout(2, 1, 5, 5));

innerPanel.setPreferredSize(new Dimension(800, 220));

innerPanel.setBackground(Color.WHITE);

JLabel lblMessage = new JLabel("High Score", JLabel.CENTER);

lblMessage.setForeground(Color.BLACK);

lblMessage.setFont(defaultFont);

lblMessage.setHorizontalTextPosition(JLabel.CENTER);

txtHighScore = new JTextField(Integer.toString(highScore), 6);

txtHighScore.setFont(defaultFont);

txtHighScore.setHorizontalAlignment(JTextField.CENTER);

txtHighScore.setEditable(false);

innerPanel.add(lblMessage, BorderLayout.NORTH);

innerPanel.add(txtHighScore, BorderLayout.CENTER);

highScorePanel.add(innerPanel);

highScorePanel.add(backButton0);

}

public void setCreditsPanel() throws IOException {

creditsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));

creditsPanel.setBounds(0, 0, WIDTH, HEIGHT);

creditsPanel.setBackground(Color.WHITE);

creditsPanel.setCursor(Game.CURSOR_DEFAULT);

String text = "CREDITS";

if(getClass().getResourceAsStream(fileCredits) == null)

throw new FileNotFoundException("credits.txt could NOT be found!");

else {

BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(fileCredits)));

String line = " ";

while(line != null) {

text = text + " " + line;

line = reader.readLine();

}

reader.close();

}

JTextPane txtPane = new JTextPane();

txtPane.setText(text);

txtPane.setEditable(false);

StyledDocument doc = txtPane.getStyledDocument();

SimpleAttributeSet body = new SimpleAttributeSet();

SimpleAttributeSet header = new SimpleAttributeSet();

StyleConstants.setAlignment(body, StyleConstants.ALIGN_CENTER);

StyleConstants.setFontSize(body, 16);

StyleConstants.setFontSize(header, 24);

StyleConstants.setBold(header, true);

StyleConstants.setAlignment(header, StyleConstants.ALIGN_CENTER);

doc.setParagraphAttributes(7, doc.getLength(), body, false);

doc.setParagraphAttributes(0, 7, header, false);

JScrollPane scrollPane = new JScrollPane(txtPane);

scrollPane.setPreferredSize(new Dimension(850, HEIGHT - 200));

scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

creditsPanel.add(scrollPane);

creditsPanel.add(backButton1);

}

private JButton createButton(String[] iconFiles) {

ImageIcon[] icon = new ImageIcon[iconFiles.length];

for(int i = 0; i < iconFiles.length; ++i)

icon[i] = new ImageIcon(getClass().getResource(iconFiles[i]));

JButton button = new JButton(icon[0]);

button.setBorderPainted(false);

button.setFocusable(true);

button.setFocusPainted(false);

button.setRolloverEnabled(true);

button.setRolloverIcon(icon[1]);

button.setPressedIcon(icon[2]);

button.setContentAreaFilled(false);

button.addActionListener(this);

return button;

}

public void startGame() throws IOException {

Thread t = new Thread(new Runnable() {

public void run() {

setState(GameState.WAIT);

add(menuPanel);

GameBoard board = null;

while(!state.equals(GameState.QUIT)) {

switch (state) {

case WAIT:

try {

Thread.sleep(200);

} catch (InterruptedException e) {

exceptionOther(e.getMessage());

}

break;

case NEW:

remove(menuPanel);

repaint();

try {

board = new GameBoard();

} catch (IOException e) {

exceptionIO(e.getMessage());

}

add(board);

pack();

board.gameLoop();

setState(GameState.WAIT);

break;

// After game over if user wants to play a new game.

case CONTINUE:

try {

saveHighScore();

} catch (IOException e) {

exceptionIO(e.getMessage());

} catch (SecurityException e) {

exceptionSecurity(e.getMessage());

}

remove(board);

repaint();

try {

board = new GameBoard();

} catch (IOException e) {

exceptionIO(e.getMessage());

}

add(board);

repaint();

pack();

board.gameLoop();

setState(GameState.WAIT);

break;

try {

saveHighScore();

} catch (IOException e) {

exceptionIO(e.getMessage());

} catch (SecurityException e) {

exceptionSecurity(e.getMessage());

}

remove(board);

repaint();

add(menuPanel);

repaint();

pack();

setState(GameState.WAIT);

break;

case HIGHSCORE:

txtHighScore.setText(Integer.toString(getHighScore()));

remove(menuPanel);

repaint();

add(highScorePanel);

repaint();

pack();

setState(GameState.WAIT);

break;

case CREDITS:

remove(menuPanel);

repaint();

add(creditsPanel);

repaint();

pack();

setState(GameState.WAIT);

break;

case QUIT:

break;

}// End of switch-case

}// End of while

dispose();

System.exit(0);

}// End of run.

});// End of Thread t.

t.start();

}

private void exceptionIO(String e) {

JOptionPane.showMessageDialog(null,

"It seems that there is a problem on your file system! Error: " + e,

"Opps!! Something went wrong!", JOptionPane.ERROR_MESSAGE);

}

private void exceptionSecurity(String e) {

JOptionPane.showMessageDialog(null,

"It seems that there is a problem about file's permission! Error: " + e,

"Opps!! Something went wrong!", JOptionPane.ERROR_MESSAGE);

}

private void exceptionOther(String e) {

JOptionPane.showMessageDialog(null,

"We are sorry about that! Error: " + e,

"Opps!! Something went wrong!", JOptionPane.ERROR_MESSAGE);

}

@Override

public void actionPerformed(ActionEvent e) {

if(e.getSource().equals(playButton))

setState(GameState.NEW);

else if(e.getSource().equals(highScoreButton))

setState(GameState.HIGHSCORE);

else if(e.getSource().equals(backButton0) || e.getSource().equals(backButton1)) {

remove(((JButton) e.getSource()).getParent());

repaint();

add(menuPanel);

pack();

setState(GameState.WAIT);

}

else if(e.getSource().equals(quitButton))

setState(GameState.QUIT);

else if(e.getSource().equals(creditsButton))

setState(GameState.CREDITS);

}

}