0

How do I find out whether my object (image) is in focus or not in Java?

How to find out which object currently has focus

In this link I get focus about component but I want focusing on image.

Community
  • 1
  • 1
  • 2
    Only components can have focus... – MadProgrammer Dec 03 '14 at 04:31
  • ok, it means we cant focus on image inside viewport?? plaese help – user3771334 Dec 03 '14 at 04:42
  • How are the images displayed in this viewport? How do you distinguish between all the other images that might be in this viewport? Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses – MadProgrammer Dec 03 '14 at 04:43
  • 2
    You can always add in image to a JLabel as an Icon and then add the label to the panel. Or you can use a JList and add an Icon to the JList. The JList contains a selection listener which you can use to know which item in the list is currently selected. – camickr Dec 03 '14 at 04:46

0 Answers0