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

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

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

import org.fxmisc.richtext.model.SimpleEditableStyledDocument;

import javafx.scene.text.TextAlignment;
import javafx.scene.text.TextFlow;

/**
 * A TextField that uses inline CSS, i.e. setStyle(String), to define the styles of text segments.
 * 

Use CSS Style Class ".styled-text-field" for styling the control. * @author Jurgen */ public class InlineCssTextField extends StyledTextField { public InlineCssTextField() { super( "", TextFlow::setStyle, "", TextExt::setStyle, new SimpleEditableStyledDocument<>("", "") ); } public InlineCssTextField( String text ) { this(); replaceText( text ); getUndoManager().forgetHistory(); getUndoManager().mark(); } @Override protected void changeAlignment( TextAlignment txtAlign ) { setParagraphStyle( 0, "-fx-text-alignment: "+ txtAlign ); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy