문제

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?

도움이 되었습니까?

해결책

So i found an answer.

Component c=(Component)e.getSource();
   Point mousePos =e.getLocationOnScreen();
    Accessible a;
    a = SwingUtilities.getAccessibleAt(c, mousePos);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top