本帖最後由 李泳霖 於 2023-6-12 19:05 編輯
試分別使用「成員內部類別」與「匿名內部類別」,實作「MouseListener介面」或繼承「MouseAdapter類別」,產生四個滑鼠事件傾聽者,完成如下的視窗程式,視窗上的圖案點擊便能置換,且彼此不會相互干擾。
JFrame的設定: 100, 100, 420, 320
JLabel的設定:
50, 20, 128, 128
250, 20, 128, 128
50, 160, 128, 128
250, 160, 128, 128



素材: |