572 } 573 574 public void inquireCandidatePosition() 575 { 576 Component source = getClientComponent(); 577 if (source == null) { 578 return; 579 } 580 // This call should return immediately just to cause 581 // InputMethodRequests.getTextLocation be called within 582 // AWT Event thread. Otherwise, a potential deadlock 583 // could happen. 584 Runnable r = new Runnable() { 585 @Override 586 public void run() { 587 int x = 0; 588 int y = 0; 589 Component client = getClientComponent(); 590 591 if (client != null) { 592 if (haveActiveClient()) { 593 Rectangle rc = inputContext.getTextLocation(TextHitInfo.leading(0)); 594 x = rc.x; 595 y = rc.y + rc.height; 596 } else { 597 Point pt = client.getLocationOnScreen(); 598 Dimension size = client.getSize(); 599 x = pt.x; 600 y = pt.y + size.height; 601 } 602 } 603 604 openCandidateWindow(awtFocussedComponentPeer, x, y); 605 } 606 }; 607 WToolkit.postEvent(WToolkit.targetToAppContext(source), 608 new InvocationEvent(source, r)); 609 } 610 611 // java.awt.Toolkit#getNativeContainer() is not available | 572 } 573 574 public void inquireCandidatePosition() 575 { 576 Component source = getClientComponent(); 577 if (source == null) { 578 return; 579 } 580 // This call should return immediately just to cause 581 // InputMethodRequests.getTextLocation be called within 582 // AWT Event thread. Otherwise, a potential deadlock 583 // could happen. 584 Runnable r = new Runnable() { 585 @Override 586 public void run() { 587 int x = 0; 588 int y = 0; 589 Component client = getClientComponent(); 590 591 if (client != null) { 592 if (!client.isShowing()) { 593 return; 594 } 595 if (haveActiveClient()) { 596 Rectangle rc = inputContext.getTextLocation(TextHitInfo.leading(0)); 597 x = rc.x; 598 y = rc.y + rc.height; 599 } else { 600 Point pt = client.getLocationOnScreen(); 601 Dimension size = client.getSize(); 602 x = pt.x; 603 y = pt.y + size.height; 604 } 605 } 606 607 openCandidateWindow(awtFocussedComponentPeer, x, y); 608 } 609 }; 610 WToolkit.postEvent(WToolkit.targetToAppContext(source), 611 new InvocationEvent(source, r)); 612 } 613 614 // java.awt.Toolkit#getNativeContainer() is not available |