• Post Reply Bookmark Topic Watch Topic
  • New Topic

do click  RSS feed

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a series of buttons on my application. I have added a menu bar with menu items that match my buttons. I have coded my menu items with buttons.doClick(). So when I click on a menu item the associated button is performed, which is what I want to happen.
My problem is that when I click on the menu item the associated button flashes like it is being clicked with the mouse. I want the button method performed but I do not want the button to flash. The only time the button should flash is if I click on the button with my mouse.
Any ideas on keeping that button from flashing.
Thanks,
Craig
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put the code attached to the button into a separate method, then call the
method from either the button or the menu
 
Craig Parsons
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try that.
Thanks,
 
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the Action class... just create an Action subclass to actually do what you want to, then just create a menu item and a button using the same Action.
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!