Code review request: 7025699: Policy Tool is not accessible by keyboard

Weijun Wang weijun.wang at oracle.com
Wed Apr 24 22:41:04 PDT 2013


Hi All

Please take a look at

    http://cr.openjdk.java.net/~weijun/7025699/webrev.00/

The bug is about policytool not accessible through a keyboard. Mainly 
two problems: First menu items have no key accelerators. Second, 
pressing ENTER on any button is not working.

Basically I made these changes:

1. Assign shortcut keys to 5 menu items, like this

-        menu.add(QUIT);
+        menu.add(new MenuItem(QUIT, new MenuShortcut(KeyEvent.VK_Q)));

2. Make all buttons ENTER aware. In the program, an action listener is 
added to a button with

    button.addActionListener(new MainWindowListener(tool, this));

and this MainWindowListener implements ActionListener. After this, it 
seems the button can react to mouse click event. It also reacts to 
spacebar press, but no other key.

Anyway, I make all these button listeners also implementing KeyListener, 
and override the keyReleased event there so that when ENTER is pressed 
on a button, trigger a mouse click event on it.

Now it seems working in Mac OS X, Linux and Windows XP. However, I'm 
really not a GUI guy and I am not sure if this fix is the right way.

The bug mentions High Contrast Mode is also not working. I have no idea 
how to fix that.

Thanks
Max


More information about the security-dev mailing list