• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

add image into buttons etc

 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have buttons,

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

which method to do so?
 
Vani Shastri
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

guess this should work.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or use the constructor

public JButton(Icon icon)
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you all seniors.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic