`

Accessible抽象类的实现

阅读更多
<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>

今天看了一点英文资料:

The Quintessential Accessible Object
You should try to subclass from JComponent or one of its
descendents since that will automatically make your object
accessible. If that is not possible, your object should implement
Accessible.


import javax.accessibility.*;


public class BasicAccessible implements Accessible {
public AccessibleContext getAccessibleContext() {
return new AccessibleContext() {
// Implement all the abstract methods in this
// abstract class.
};
}
}

java.accessibility包定义了用户界面组件与提供对这些组件进行访问的辅助技术之间的协定。如果 Java 应用程序完全支持 Java Accessibility API,则它应该与屏幕读取器、屏幕放大器这样的辅助技术保持兼容和友好。使用完全支持 Java Accessibility API 的 Java 应用程序,将不再需要离屏模型的屏幕读取器 ,因为该 API 提供了离屏模型中通常所包含的所有信息。

上面的一段英文的意思是:你应该试着从JComponent或它的某个子类中产生子类,因为这样可以自动地让你的对象可被访问。如果那样不可能做到的话,那你的对象必须实现为可访问的对象。

上面的代码是一个编写可访问对象的一个框架,该类必须实现Accessible抽象类中的所有抽象方法。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics