[英]I can't draw multiple lines in JLabel with mouse listener such as pressed and released
[英]Is there a way to detect mouse released on another JLabel?
您好,假設我有兩個不同的JLabel,實現了兩個不同的MouseListener。
我想要的是在Label1上按下鼠標,如果我在Label2上釋放它,則返回true,否則返回false。
有什么辦法嗎? 我正在嘗試hasFocus()方法,還有更多方法,但是沒有一個可以滿足我的需要。
您應該考慮使用MVC:這是它的確切目的!
本教程非常簡單,並得到了很好的解釋: http : //www.tutorialspoint.com/design_pattern/mvc_pattern.htm
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.