I *know* I have seen this addressed recently, but I've been flipping
through the javadocs, googling, and search google groups, all without
success.
I have a JPanel that has a JButton. How can I translate a point in
one to the coordinate space of the other?
The more general problem I am trying to address:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6359129
The idea is, since the clicks don't work if the popup goes beyond the
browser, I can instead move the popup higher so that it fits within
the browser window. But I'm using
popup.show(button, 5, button.getHeight() - 7);
(showing the popup in the JButton's coordinate space), and I need to
know where it is displaying relative to the JPanel (actually, I guess
it would suffice to know where it is displaying relative to the entire
applet window).

Signature
monique
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Roedy Green - 28 Mar 2006 03:14 GMT
On Mon, 27 Mar 2006 17:32:48 -0700, "Monique Y. Mudama"
<spam@bounceswoosh.org> wrote, quoted or indirectly quoted someone who
said :
>I have a JPanel that has a JButton. How can I translate a point in
>one to the coordinate space of the other?
see http://mindprod.com/jgloss/affinetransform.html
gives you generic way of transforming co-ordinates.
as for you specific problem, see
http://mindprod.com/jgloss/coordinates.html#RELATIVEORIGIN

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Monique Y. Mudama - 28 Mar 2006 04:02 GMT
> On Mon, 27 Mar 2006 17:32:48 -0700, "Monique Y. Mudama"
><spam@bounceswoosh.org> wrote, quoted or indirectly quoted someone
[quoted text clipped - 8 lines]
> as for you specific problem, see
> http://mindprod.com/jgloss/coordinates.html#RELATIVEORIGIN
Thanks! I knew there was a method "somewhere" out there specific to
Components; I just couldn't find it (apparently because I thought it
would be called transformSomething, not convertSomething).

Signature
monique
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Thomas Weidenfeller - 28 Mar 2006 08:05 GMT
> I *know* I have seen this addressed recently, but I've been flipping
> through the javadocs, googling, and search google groups, all without
> success.
>
> I have a JPanel that has a JButton. How can I translate a point in
> one to the coordinate space of the other?
SwingUtilities.convertPoint()
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/