Page 170 - MDP2022-3
P. 170
Music buttonEnteredMusic = new
Music("buttonPressedMusic.mp3" , false);
buttonEnteredMusic.start();
}
@Override
public void mouseExited(MouseEvent e) {
easyButton.setIcon(easyButtonBasicImage);
easyButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
@Override
public void mousePressed(MouseEvent e) {
Music buttonEnteredMusic = new
Music("buttonPressedMusic.mp3" , false);
buttonEnteredMusic.start();
gameStart(nowSelected , "Easy");
}
});
add(easyButton);
backButton.setVisible(false);
backButton.setBounds(20, 50, 60, 60);
backButton.setBorderPainted(false);
backButton.setContentAreaFilled(false);
backButton.setFocusPainted(false);
backButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
backButton.setIcon(backButtonEnteredImage);
backButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
Music buttonEnteredMusic = new
Music("buttonPressedMusic.mp3" , false);
buttonEnteredMusic.start();
}
@Override
public void mouseExited(MouseEvent e) {
backButton.setIcon(backButtonBasicImage);
backButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
@Override
public void mousePressed(MouseEvent e) {
Music buttonEnteredMusic = new
Music("buttonPressedMusic.mp3" , false);
buttonEnteredMusic.start();