• Post Reply Bookmark Topic Watch Topic
  • New Topic

menuitems

 
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
 
Paper has not yet been outlawed – so let your Java Swing application print with wild abandon: JPDF
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!