0

i am trying to make an App, with javax.accessibility. I have a Frame with a Panel and at this Panel is a Button. I made an accessibility class, included it to the accessibility.properties and made this class implements GUIInitializedListener, MouseListener

So for a Test i did this

public void mouseClicked(MouseEvent e) {
    Point mousePos = EventQueueMonitor.getCurrentMousePosition();
    Accessible accComp = EventQueueMonitor.getAccessibleAt(mousePos);
    String accName = accComp.getAccessibleContext().getAccessibleName();
    System.out.println(accName);
 }

what i wanted is to become Accessible name and show it at Console. but I allways getting mousePos=null. I dont understand what i am doing wrong. Can anybody help me?

4

1 回答 1

0

So i found an answer.

Component c=(Component)e.getSource();
   Point mousePos =e.getLocationOnScreen();
    Accessible a;
    a = SwingUtilities.getAccessibleAt(c, mousePos);
于 2013-06-14T10:38:19.367 回答