Reputation: 3
I have an opened an image using JFrame in java. Now I want to display a button at particular location in that image to do certain task. But i feel it to be more challenging. Please give me an idea or source code to do my task.
waiting for valuable reply
Upvotes: 0
Views: 218
Reputation: 46960
Look at the LayeredPane layout manager. This will easily overlay a button on a picture.
Upvotes: 1
Reputation: 791
Why don't you try to just add a click the image to run the command you want just like button use mouse listener. or just prompt a JOption pane for options for the Image?
Upvotes: 0
Reputation: 41
You can make a JComponent and use a MouseListener to see if the user clicks in the area of the image. Thus you can execute your action if the user clicks.
Upvotes: 2