`

Setting an Accessible Name for an Image Button

阅读更多
<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>

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

为一个图像按钮设置一个存取名,你也应该为只显示图像的部件设置一个存取名。如果一个组件的提示符设置了的话,那么它可以作为这个组件的名字。然而,如果部件提示符被用于其他事情,就要设置它的存取名。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics