سؤال

Sorry, but I am afraid!

I have mouse listener attached to my custom tab component. When I click on this tab I want to translate mouse Point to coordinates of parent JTabbedPane.

How to do this in swing?

Thanks friends!

هل كانت مفيدة؟

المحلول

It appeares to be very easy to do.

Class javax.swing.SwingUtilities has a set of methods that convert Point and Rectangle from coordinate system of one component to another component.

It is also possible to convert MouseEvent.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top