Question: Java JPanel questions How do you draw multiple line and square in one JPanel? how do you keep track on that x and y value

Java JPanel questions

How do you draw multiple line and square in one JPanel?

how do you keep track on that x and y value (Starting x and y value, end x and y value) when the mouse listener get call every time?

and how do you make this class implement an action listener. Please if you could explain to me what to do in the code.

In the code it should be able to draw multiple line and square with any size that mouselistener get from user, also it has to have one reset button that clear everything in jpanel.

they said have to override the paintComponent() but how do i do that? can you please give example either square or line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!