pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: Adding bolded text to TableView Cell
Date Fri, 18 Jun 2010 19:42:14 GMT
Is the bold state based on some conditional logic, or will it always be bold? If it is always
bold, you can just create a new instance of TableViewCellRenderer for that column and set
its font style to bold:

<TableView.Column name="myBoldColumn">
    <content:TableViewCellRenderer styles="{font:{bold:true}}"/>

Otherwise, you can easily extend the TableViewCellRenderer class and override render() to
make the text bold as needed:

public void render(...) {

    if (shouldBeBold) {
        Font font = (Font)getStyles().get("font");
        getStyles().put("font", font.deriveFont(Font.BOLD));

Then set the cell renderer for that column to your custom renderer class, similar to what
is shown above.

Hope this helps.


On Jun 18, 2010, at 3:05 PM, JohnRodey wrote:

> We've discussed before adding textual highlighting to a textarea, in which
> case I created a decorator to draw a colored box around the selected text.
> I would now like to bold certain words in a string within a tableview cell. 
> I don't think the decorator approach will work, at least not as simply,
> because drawing bolded text on top of the regular text will result in a
> longer string (in most fonts) and the two will not match up.
> Any ideas?
> -- 
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Adding-bolded-text-to-TableView-Cell-tp906255p906255.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

View raw message