how can I click an image like a button..
so instead of using the JButton I am using an Image
Printable View
how can I click an image like a button..
so instead of using the JButton I am using an Image
Use the setIcon method of JButton to set the image. You can also use the setPressedIcon to have the icon change when the JButton is pressed. I recommend reading the Swing tutorial provided by Oracle for more information:
How to Use Buttons, Check Boxes, and Radio Buttons (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
Alternatively you could draw your image on a JComponent and add a MouseListener to manage clicks.