I have to add a mouse over event and mouse click event in my rectangles that I draw while taking the values from an input file. Now since I am taking rectangle height and width from the input text file as well I also want to take a text value to be shown while moving a mouse over a particular rectangle from my input file. Also when user clicks on that rectangle the height and width of that particular rectangle only should be displayed (re-adjusted).
Like suppose my input file has 3 fields:-
Height Width Test_To_Show 10 23 Hello 20 44 Bye
Now When my paint component draws these 2 rectangles and a user moves his mouse over the rectangle he should see text message attached to it:- Like for first row 10, 23 he should see "Hello". In this case when he clicks on this rectangle the picture should read just to show only 10 and 20 as height and width.
I am trying to write 2 classes. 1st one extends JPanel and the other one MouseInputAdapter.
It would be great to get help and guidance from you guys.