Volodymyr Levytskyi
Volodymyr Levytskyi

Reputation: 3432

How to translate mouse point of Tab to Point of JTabbedPane?

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!

Upvotes: 1

Views: 120

Answers (1)

Volodymyr Levytskyi
Volodymyr Levytskyi

Reputation: 3432

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.

Upvotes: 1

Related Questions