-2
@FXML
void afficher(KeyEvent event) {
   
    if (event.getCode() == KeyCode.ENTER) {
    }

I want to make a simple key pessed method, but Netbeans underlines the getCode() in red whatever I do.

I got:

cannot find symbol symbol: method getCode() location: variable event of type KeyEvent
Flip operands of the binary operator
jewelsea
  • 150,031
  • 14
  • 366
  • 406

1 Answers1

4

Most probably you have imported the KeyEvent from the java.awt.event.KeyEvent package, you should import it from javafx.scene.input.KeyEvent