質問

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