Page 169 - MDP2022-3
P. 169
selectLeft();
}
});
add(leftButton);
rightButton.setVisible(false);
rightButton.setBounds(1170, 550, 60, 60);
rightButton.setBorderPainted(false);
rightButton.setContentAreaFilled(false);
rightButton.setFocusPainted(false);
rightButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
rightButton.setIcon(rightButtonEnteredImage);
rightButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
Music buttonEnteredMusic = new
Music("buttonPressedMusic.mp3" , false);
buttonEnteredMusic.start();
}
@Override
public void mouseExited(MouseEvent e) {
rightButton.setIcon(rightButtonBasicImage);
rightButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
@Override
public void mousePressed(MouseEvent e) {
Music buttonEnteredMusic = new
Music("buttonPressedMusic.mp3" , false);
buttonEnteredMusic.start();
selectRight();
}
});
add(rightButton);
easyButton.setVisible(false);
easyButton.setBounds(670, 550, 500, 67);
easyButton.setBorderPainted(false);
easyButton.setContentAreaFilled(false);
easyButton.setFocusPainted(false);
easyButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
easyButton.setIcon(easyButtonEnteredImage);
easyButton.setCursor(new Cursor(Cursor.HAND_CURSOR));