0

I have JFXPanel's contained within a JFrame that has a JMenuBar up top. The menus have mnemonics associated with them, though the JFXPanel's have button's with mnemonics associates with them as well. Currently pressing Alt + C invokes the JFXPanel Close Button action, but also opens the Collections menu from the JMenuBar. Any suggestions for how to handle?

Tommo
  • 977
  • 14
  • 35

1 Answers1

0

Adding this to the JFXPanel did the trick:

this.addKeyListener(new KeyListener() {
  @Override
  public void keyTyped(KeyEvent e) {
    if(e.isAltDown()) {
      e.consume();
    }
  }
  @Override
  public void keyReleased(KeyEvent e) {
    if(e.isAltDown()) {
      e.consume();
    }
  }
  @Override
  public void keyPressed(KeyEvent e) {
    if(e.isAltDown()) {
      e.consume();
    }
  }
});
Tommo
  • 977
  • 14
  • 35