mercredi 25 février 2015

Java Break a while loop with enter button

the thing is that I'm making a JFrame with text shown almost lik an visual novel. And when the text in the JLabel is done, a blinking arrow symbol ">" is shown at the bottom. I get this far, but how to I make the 'while' loop break if I press the enter key. Allmost all answers on the web was about JTextField and Console...



public static void nextSymbol(boolean blink) {
ImageIcon nextIcon = null;
boolean blinked = false;
if(blink) {
nextIcon = new ImageIcon("res/image/next.gif");
while(blink){
if (/* When ENTER is pressed */){
System.out.println("Disabled");
blink = false;
}
pause(0.01);
}
blinked = true;
}
if(!blink && blinked)
vnGame.nextSymbolIcon.setIcon(null);
else
;
blinked = false;
}

Aucun commentaire:

Enregistrer un commentaire