To add an invisible panel over it is not an option, since the button in this case will still be available for pressing. I also need to be able to press only programmatically (doClick ()), but the user could not. What are the options?

  • Is someone else programming under the swing? Why JavaFX, if you are a hardcore and love outdated technology. - AlexOrtizzz
  • button.setEnabled (false); what does not fit? - Senior Pomidor
  • @SeniorAutomator for buttons already inactive icons are set, now I understand that from the very beginning it was necessary to implement differently. I would not like to rewrite everything from scratch. I did it cleverly, but probably not optimally - I deleted all the handlers, and before each doClick call I add this listener. - user193688
  • @ Alexey Perestoronin Well, I am learning so far and have chosen the implementation of the game on Swing as independent, I will master JavaFX - user193688
  • one
    You can wrap the components in JLayer, and intercept mouse events in it. - zRrr

0