Link to home
Start Free TrialLog in
Avatar of hipal
hipalFlag for United States of America

asked on

Image as a JButton

I am still not able to  make a image a JButton after all the help in previous post.

Thanks to my poor Java Knowledge.

Can some one please help more on this ? May be some little code snippet.

I am trying to make a image act as a JButton and not to insert a image in a button.

Thanks !
Avatar of ksivananth
ksivananth
Flag of United States of America image

Avatar of Mick Barry
thats going to be a fair bit of work to do properly.
far easier to use existing JButton class
Can you attach an image you'd like to use?
Avatar of hipal

ASKER

Thanks everyone.

@CEHJ, Please find the pic attached. Or you can just use any pic.

I have to make a lot of buttons using different pics.
pic.png
ASKER CERTIFIED SOLUTION
Avatar of ksivananth
ksivananth
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>you can simply use JButton/JLabel and set this as icon with empty border

An empty border isn't sufficient actually
Avatar of hipal

ASKER

yes, we need to set the contentfillarea too .. :(

I just realized that ksiv.suggested just to make border zero ..

Anyways ....
that what I had already suggested ;)