wood burning stoves*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Rendering Labels with icons" Watch "Rendering Labels with icons" New topic

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?

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!
I agree. Here's the link: http://aspose.com/file-tools
subject: Rendering Labels with icons
Similar Threads
FTP files System Icons
wraping in JTable cell
display icon/text on right of selected node in jtree
Parsing data out of an XML document
Grid header for JTable