This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 13861 - [GUI Forms/Template Forms] should conform to accessibility/JLF requirements
Summary: [GUI Forms/Template Forms] should conform to accessibility/JLF requirements
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords: A11Y
: 106315 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-07-23 23:18 UTC by jhoffman
Modified: 2011-01-28 12:20 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch (5.97 KB, text/plain)
2011-01-21 15:20 UTC, Antonin Nebuzelsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jhoffman 2001-07-23 23:18:27 UTC
The New > Sample Forms > OKCancelDialog does not conform to JLF or accessibility requirements.  It should
have a default button (set using JRootPane.setDefaultButton()) which responds to the "Enter" key.  Also, 
the cancel button should respond to the "Esc" key.

Similarly, the Sample Forms > Application and MDI Application forms should have mnemonics on the menu items.

These are simple fixes that would enable developers to start creating accessible applications.
Comment 1 Jiri Mzourek 2001-08-07 14:22:35 UTC
reassigned
Comment 2 Jan Chalupa 2001-11-27 17:08:25 UTC
Target milestone -> 3.3.1.
Comment 3 Marek Grummich 2002-07-22 11:47:33 UTC
Set target milestone to TBD
Comment 4 Marek Grummich 2002-07-22 11:51:47 UTC
Set target milestone to TBD
Comment 5 Marian Mirilovic 2005-11-08 15:09:57 UTC
Yes, that's true and still valid issue. Reassigne to form for evaluation, it is
probably usersguide's issue ;)
Comment 6 Jan Stola 2005-12-02 14:50:05 UTC
We will rethink meaning and form of these templates for the next release.
Comment 7 Jan Stola 2008-03-07 09:20:30 UTC
*** Issue 106315 has been marked as a duplicate of this issue. ***
Comment 8 Jaromir Uhrik 2010-10-19 13:47:34 UTC
Yes, I always need to code myself Escape/Enter keys handling for each OK/Cancel dialog. Please change the template to contain code like following:

 getRootPane().setDefaultButton(this.okButton);
        Action cancelKeyAction = new AbstractAction("Cancel") {
            public void actionPerformed(ActionEvent e) {
                doClose(RET_CANCEL);
            }
        };        
        cancelButton.setAction(cancelKeyAction);
        String cancelName = "cancel";
        InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        ActionMap actionMap = getRootPane().getActionMap();
        KeyStroke cancelKeyStroke = KeyStroke.getKeyStroke((char) KeyEvent.VK_ESCAPE, 0);
        inputMap.put(cancelKeyStroke, cancelName);
        actionMap.put(cancelName, cancelKeyAction);
Comment 9 Antonin Nebuzelsky 2011-01-21 15:16:58 UTC
Jaro, thanks for the suggestion. Attaching a patch.

However, after I clean&build form module locally and restart with new userdir I still don't see the change in newly created classes in a testing project.

Tomasi, Honzo, is the patch OK?
Comment 10 Antonin Nebuzelsky 2011-01-21 15:20:36 UTC
Created attachment 105242 [details]
patch
Comment 11 Jan Stola 2011-01-23 15:01:45 UTC
> Tomasi, Honzo, is the patch OK?

No, it is not.

First of all, the patch changes just .java files. The changes must be done in .form files as well (in fact, they must be done in .form files primarily).

Mnemonics are set incorrectly. Swing components don't support setting of mnemonics using ampersand (i.e., '&' character) in their text.

The new code in OK/Cancel dialog uses several new local variables. I would be very careful with them. They can clash with the user-created components with the same names.

Final nitpick: Why there is a cast in
javax.swing.KeyStroke.getKeyStroke((char) java.awt.event.KeyEvent.VK_ESCAPE, 0);
doesn't
javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0);
work as well?
Comment 12 Jan Stola 2011-01-28 10:29:34 UTC
Fixed.

Modified files: http://hg.netbeans.org/core-main/rev/360791497b7f
Comment 13 Antonin Nebuzelsky 2011-01-28 12:20:04 UTC
Thanks, Honzo!