简体   繁体   中英

Is there a way to detect mouse released on another JLabel?

Hello suppose I have two different JLabels with two different MouseListeners implemented.

What I want is to press mouse on Label1 and return true if I release it on Label2, otherwise false.

Is there any way to do it? I was trying hasFocus() method and many more but none of them did what I need.

You should consider using MVC: it's its exact purpose!

This tutorial is quite simple and well explained: http://www.tutorialspoint.com/design_pattern/mvc_pattern.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM