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 Details

    • HTMLEditor

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

    • 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