
org.fxmisc.richtext.InlineCssTextField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of richtextfx Show documentation
Show all versions of richtextfx Show documentation
Rich-text area for JavaFX
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 - 2025 Weber Informatics LLC | Privacy Policy