本帖最后由 Inhibitory 于 2010-08-26 18:01:15 编辑

解决方案 »

  1.   

    Setting an Accessible Name for an Image Button
    You should also set the accessible name for components that only show an image. The tool tip text, if set, serves as the accessible name for a component. However, if the tool tip text is being used for something else, set the component's accessible name.
    JButton button = new JButton(new ImageIcon("image.gif")); button.setToolTipText("Button Name");
    // If tool tip is being used for something else, // set the accessible name. button.getAccessibleContext().setAccessibleName(
    "Button Name");Setting a Description for Image Icons
    Image icons can be inserted in a variety of places such as in a text or tree component. You should set a description for image icons to help blind users.
    ImageIcon icon = new ImageIcon("image.gif"); icon.setDescription("Description of Image");Setting a Mnemomic for Buttons
    JButton button = new JButton("Button"); button.setMnemonic('B'); JCheckBox checkBox = new JCheckBox("CheckBox"); checkBox.setMnemonic('C');Setting a Mnemonic for a Menu
    At least one menu in a menu bar should have a mnemonic. This makes all the menus and menu items accessible.
    JMenu menu = new JMenu("Menu"); menu.setMnemonic('M');