Skip to main content

Accelerators on hidden menu

2 replies [Last post]
txigreman
Offline
Joined: 2007-02-01
Points: 0

Hi,

I want to add an option to show or hide the menu bar, the problem is that keyboard accelerators doesn't work when the menu bar is hidden ( menuBar.setVisible(false) ).

¿Any idea?

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
txigreman
Offline
Joined: 2007-02-01
Points: 0

I've finally made a class called "JXCollapsibleMenuBar". When collpasible property is set to true the menubar disappears (by putting height to 0, key events are processed), but when a MenuItem obtains the focus (for example by pressing alt key) the menubar appears again.

Here is the class: http://txigreman.pastebin.com/qd7NtRB2

PD: Yes, menu's listener should be deleted when the menu item is removed... Maybe in v2.0, I don't remove menu items. lol

walterln
Offline
Joined: 2007-04-17
Points: 0

Add [url=http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]key bindings[/url] (short cuts) for the menu actions as well.