Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

menuitems  RSS feed

 
kieran pattni
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..is it pos to have multi menItems with same ActionListener class .. ActionEvent to choose to switch method case..i am copying notepad for mess about...i know switch does not use strings..many thanks

File Menu
"New Ctr+N"
"Open Ctr+O"

eg switch(...)
case: jump to method()...break
case: jump to method()...break
case: jump to method()...break etc
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
event.getSource() will give you the info you want, but menuItems generally
do vastly different things, so having their own separate listener/s makes more sense
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!