Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Rendering Labels with icons  RSS feed

 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a cell in a JTable that in some situations has an icon to the left
of it in the same cell. I would like the text to be aligned on the right
and the icons on the left. How do I do that?

Thanks.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default render is a subclass of JLabel, so you can use JLabel methods to alter its look, like it's alignment properties. One thing I've found handy for aligning is to use an empty icon to preserve alignments:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!