List of usage examples for javax.accessibility AccessibleContext setAccessibleDescription
@BeanProperty(preferred = true, description = "Sets the accessible description for the component.") public void setAccessibleDescription(String s)
From source file:Main.java
public static <T extends Component> T setAccessibleContext(T comp, String name) { if (comp == null) return comp; AccessibleContext ac = comp.getAccessibleContext(); if (ac == null) return comp; String text = null;/* w ww . ja v a 2 s . c o m*/ if (name != null && !name.isEmpty()) text = name; else if (comp instanceof AbstractButton) text = ((AbstractButton) comp).getText(); else text = comp.getName(); if (text != null) { ac.setAccessibleName(text); ac.setAccessibleDescription(text); } return comp; }
From source file:MainClass.java
MainClass(String title) { super(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); AccessibleContext ac = getAccessibleContext(); ac.setAccessibleDescription("Accessibility Demo1 description."); ac = getRootPane().getAccessibleContext(); ac.setAccessibleName("Root pane"); ac.setAccessibleDescription("Root pane description"); ac = getGlassPane().getAccessibleContext(); ac.setAccessibleName("Glass pane"); ac.setAccessibleDescription("Glass pane description"); ac = getLayeredPane().getAccessibleContext(); ac.setAccessibleName("Layered pane"); ac.setAccessibleDescription("Layered pane description"); ac = getContentPane().getAccessibleContext(); ac.setAccessibleName("Content pane"); ac.setAccessibleDescription("Content pane description"); JPanel p = new JPanel(); ac = p.getAccessibleContext();//from w ww.j a va2 s . com ac.setAccessibleName("Panel"); ac.setAccessibleDescription("Panel description"); jb = new JButton("Press Me"); jb.addActionListener(this); jb.setToolTipText("Press me for accessibility information."); p.add(jb); getContentPane().add(p); setSize(200, 75); setVisible(true); }