Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Code Samples

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button

Members Only Requires login

Early Access Members Only

Downloads

Bug Database Members Only
Submit a Bug
View Database

Newsletters
Back Issues
Subscribe

Learning Centers
Articles
Bookshelf
Code Samples
New to Java
Question of the Week
Quizzes
Tech Tips
Tutorials

Forums

Technology Centers
javax.accessibility
Code Samples Index

These code examples and other materials are subject to Sun Microsystems, Inc. Legal Terms

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");
 
 

Examplets TM provided by permission of the publisher, Addision-Wesley, and Author Patrick Chan.
Order this book from Amazon


Print Button
[ This page was updated: 10-Apr-2001 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary | Feedback | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2001 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.