How to call a function when I click on a jPanel (Java)?
问题 I'm working with Netbeans IDE in Java. I've a form with one JPanel. Each JPanel has a gridLayout 3x3 and in each place there is an image representing a number[0,1,2,3,4,5,6,7,8](the image is created used a custom class,not just fitting the image in a lab). I want to be able to exchange two images in the panel when the user click them (First click: no action , second click: switch the two images fitted in the jPanel Components). I already created a function exchangeComponents and with a test