Module javafx.web

Class HTMLEditor

  • All Implemented Interfaces:
    Styleable, EventTarget, Skinnable

    public class HTMLEditor
    extends Control
    A control that allows for users to edit text, and apply styling to this text. The underlying data model is HTML, although this is not shown visually to the end-user.
    Since:
    JavaFX 2.0
    • Constructor Detail

      • HTMLEditor

        public HTMLEditor()
        Creates a new instance of the HTMLEditor control.
    • Method Detail

      • createDefaultSkin

        protected Skin<?> createDefaultSkin()
        Description copied from class: Control
        Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).
        Overrides:
        createDefaultSkin in class Control
        Returns:
        new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
      • getHtmlText

        public String getHtmlText()
        Returns the HTML content of the editor.
        Returns:
        the HTML content
      • setHtmlText

        public void setHtmlText​(String htmlText)
        Sets the HTML content of the editor. Note that if the contentEditable property on the <body> tag of the provided HTML is not set to true, the HTMLEditor will become read-only. You can ensure that the text remains editable by ensuring the body appears as such:
        
         <body contentEditable="true">
         
        Parameters:
        htmlText - the full HTML markup to put into the editor. This should include all normal HTML elements, starting with <html>, and including a <body>.
      • print

        public void print​(PrinterJob job)
        Prints the content of the editor using the given printer job.

        This method does not modify the state of the job, nor does it call PrinterJob.endJob(), so the job may be safely reused afterwards.

        Parameters:
        job - printer job used for printing
        Since:
        JavaFX 8.0