Page 177 - MDP2022-3
P. 177
public void askScore() {
scoreInput = JOptionPane.showInputDialog("랭킹에 등록할 닉네임을 입력하세요!!!");
System.out.println(scoreInput);
rankTab();
}
public void rankTab() {
background = new
ImageIcon(Main.class.getResource("../images/rankBackgournd.jpg")).getImage();
homeButton.setVisible(true);
RestartButton.setVisible(false);
RankButton.setVisible(false);
isGameScreen = false;
isMainScreen = false;
isResultScreen = false;
isRankScreen = true;
}
public void restart() {
gameStart(nowSelected , "Easy");
System.out.println("restart");
homeButton.setVisible(false);
RestartButton.setVisible(false);
RankButton.setVisible(false);
Main.score = 0;
isGameScreen = true;
isResultScreen = false;
}
}
# KeyListener 클래스
package dynamic_beat_16;
public class KeyListener extends KeyAdapter{
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_S) {
DynamicBeat.game.pressS();
}
else if(e.getKeyCode() == KeyEvent.VK_D) {
DynamicBeat.game.pressD();
}
else if(e.getKeyCode() == KeyEvent.VK_F) {