This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Rendering Labels with icons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Rendering Labels with icons" Watch "Rendering Labels with icons" New topic
Author

Rendering Labels with icons

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
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

Joined: Sep 16, 2005
Posts: 1780
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:


There is no emoticon for what I am feeling!
 
 
subject: Rendering Labels with icons