aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes add image into buttons etc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "add image into buttons etc" Watch "add image into buttons etc" New topic
Author

add image into buttons etc

Nicky Eng
Ranch Hand

Joined: Mar 26, 2005
Posts: 378
I have buttons,

example i got "Open" button, but i also want to put the image into the button.

which method to do so?


From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Vani Shastri
Ranch Hand

Joined: Aug 17, 2006
Posts: 52
Hi,

jbtnPic1 = new JButton();
jbtnPic1.setIcon(new ImageIcon ("C:/images/open.gif"));

guess this should work.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
or use the constructor

public JButton(Icon icon)
Nicky Eng
Ranch Hand

Joined: Mar 26, 2005
Posts: 378
thank you all seniors.
 
wood burning stoves
 
subject: add image into buttons etc