• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

Using a .GIF instead of button

I'm creating an applet inside VAJ 2.0 and want to use a .GIF file in the place of a button. It seems to be an easy request, but I can't seem to figure out how. What would be the best way to go about doing this?
0
BergJC
Asked:
BergJC
1 Solution
 
dvd99Commented:
I have seen this question asked lots of places and here is the answer that seems to work yhe best:

Use a JButton that has the image and no text r a JLabel with a MouseListener

and use ImageIcon image = new ImageIcon("picture.gif");

and then JButton b = new JButton(image);

This will do it!
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now