• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Context Sensitive menu??

 
katie wilson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm trying to build a context sensitive based command list. I set the command.ITEM option for all my command buttons. I referred to the Outliner example found on the net. But it is too confusing. Can anyone help me with a simple example to achieve this? The functionality I need is as follows:

I have a list of values say A, B,C
For A, my command menu should contain 2,4
When I move the selection (cursor) to B, my commands menu should have 1,3
When I move to C, commands should have 2,1
Again when I move back to A, it should have A's command menu (2,4)


Thanks in advance for any help pointing to the right direction
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Command objects, I don't think you can change them on the fly. Now there is an ItemChangeListener that can listen to the change of selection in the List, but you couldn't swap out the Commands. But you could have a "menu" in a custom Canvas, where the paint() method has if() statement that would show only certain text like

"1 - Menu Item 1"
"2 - Menu Item 2",

then you can call a method that takes the value selected and work accordingly.

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you could check out J2ME Polish, just do a search on that in Google, and maybe they have a way. They have some cool looks and stuff.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic