Adding a MouseListener to a panel

前端 未结 5 1747
轻奢々
轻奢々 2021-01-29 07:10

I am trying to add the mouse actions to my panel. This is what the program is supposed to do:

Write a program that allows the user to specify a triangle

5条回答
  •  半阙折子戏
    2021-01-29 07:35

    You have to register the listener object with the Jpanel using the addMouseListener method. More info;

    • https://docs.oracle.com/javase/7/docs/api/java/awt/event/MouseListener.html

    • https://docs.oracle.com/javase/tutorial/uiswing/events/mouselistener.html

提交回复
热议问题