Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When should the getLocation() be called

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the javadoc for java.awt.Component.getLocation(), there is such a description:

Due to the asynchronous nature of native event handling, this method can return outdated values (for instance, after several calls of setLocation() in rapid succession). For this reason, the recommended method of obtaining a component's position is within java.awt.event.ComponentListener.componentMoved(), which is called after the operating system has finished moving the component.


But I don't understand what this statement means and if the call isn't reliable at all why it is there? If I dont want the trouble of using a listener, how should we use getLocation() to retreive the component's location?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic