Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
mouseListener を DrawingPanel に実装するための非常に簡単な方法を教えていただければ幸いです。たとえば、マウス クリックのピクセルを返したい場合、どうすればよいですか? ありがとうございました。
基本的には、その描画パネルにマウス リスナーを追加するだけです。多くのチュートリアルがあります。そして、ピクセルの座標を取得するのはe.getX()、 と のe.getY()メソッドを呼び出すだけmouseClicked(MouseEvent e)です。
e.getX()
e.getY()
mouseClicked(MouseEvent e)