This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JButton Image Sprite

 
Cody Bissett
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'day everyone -

I've got an image sprite with four sections. I've also got four JButtons. The other day, I irretrievably deleted my piece of code which positioned the sprite as I wanted it in each button. Now, I've been looking for a while to find how I did it but can't for the life of me dig it up.

Any tips? It was not a long piece of code and had something to do with ImageIcon, if I recall correctly. Thanks ahead of time for your help.


Cody
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Rob Camick
Ranch Hand
Posts: 2703
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
Cody Bissett
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers guys, glad to be here.

Your examples put me on the right path, and I found what I did:



That'll let me use my single image sprite in several buttons.

Cody
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!