• Post Reply Bookmark Topic Watch Topic
  • New Topic

using getLocationOnScreen()  RSS feed

samuel, liu
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I am trying to use Component.getLocationOnScreen()to get the location of any given active/focused Swing Component.
I tested it, it works fine. however, there is one problem: in order to use getLocationOnScreen(), then the active window has to be "extends Component". Well, yes, any JComponent is a Component, but if the programmers didn't mark "extends Component" in their code (in their class definitions), then getLocationOnScreen() can't get the coordinates from that window(or whatever it is). the pain is that it is totally legal to define a Swing class without extends it to a Swing Component.
do you have any suggestions on that problem?
thank you.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!