This content has been marked as final. Show 8 replies
Edited by: jsmith on Jan 30, 2013 2:11 PM
Label label = new Label("xyzzy"); label.setContentDisplay(ContentDisplay.RIGHT); label.setGraphic(imageView); TableColumn column = new TableColumn(); column.setGraphic(label);
Set the text directly to the additional label rather than than binding to the column name (the column name is not used).
Ah yeah thanks. I always forget about the Content display stuff!
Umm on OS X this doesn't seem to work -- the label/image always appears to the left of the table header, no matter what I set the content display value to?!
Just to clarify.
Your code puts the header label in the middle of the column, and the header label with an image to the left of it?
Or are you trying to replace the table column header completely with your new label?
Works for me with ContentDisplay.RIGHT, I made some minor updates to the code in my answer to make things a bit clearer.
Your code puts the header label in the middle of the column, and the header label with an image to the left of it?No, the image is show to the right of the text.
are you trying to replace the table column header completely with your new label?The table has column has a label for displaying the column header.
You can set a graphic on this label, but you cannot modify the content-display settings of the label (via API without resorting to tricks like node lookups via css).
So my code creates a new label, sets the text and graphic on the new label, sets the content display of the new label to right so that the graphic displays to the right of the label, then sets the graphic on the table column to the new label.
Ok, so you are replacing the table header label with your own. That works as long as I don't set the columns header text (which your original code did). That was the confusion. So thanks, it works just great now.
Yep, sorry for confusion. Glad it's working for you now.