Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setAccelerator in Java 6 wont work with invisible JMenuItem  RSS feed

 
R.Joe
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI all,
i have a problem with Java 6.
I used an invisibleMenuItem to enable some shortkey. it works fine with Java 5.
while with Java 6, the following methods wont work anymore

invisibleMenuItem.setAccelerator
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check key bindings.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JMenuBar menuBar = new JMenuBar(){public boolean isShowing(){return true;}};

[edit]
the above is for the accelerators to work when the menuBar is hidden,
just realized it's probably just your menuItem that's hidden.
[ September 23, 2008: Message edited by: Michael Dunn ]
 
R Davis
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Had the same problem, and the fixes suggested above don't work.

It's only the item that's invisible, not the entire menu (I want to keep some commands known only to the administrator of a program).

This worked fine in 5, and with no code change fails to work in 6.

Any ideas?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by R Davis:

Any ideas?


Afraid you will have to go through with Rob's suggestion of key bindings.
His post has the relevant link.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!