All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fxmisc.richtext.InlineStyleTextArea Maven / Gradle / Ivy

There is a newer version: 0.11.4
Show newest version
package org.fxmisc.richtext;

import java.util.function.Function;

/**
 * Text area that uses inline css derived from the style info to define
 * style of text segments.
 *
 * @param  type of style information.
 */
public class InlineStyleTextArea extends StyledTextArea {

    /**
     *
     * @param initialStyle style to use for text ranges where no other
     *     style is set via {@code setStyle(...)} methods.
     * @param styleToCss function that converts an instance of {@code S}
     *     to a CSS string.
     */
    public  InlineStyleTextArea(S initialStyle, Function styleToCss) {
        super(initialStyle, (text, style) -> text.setStyle(styleToCss.apply(style)));
    }

}