Class SelectableText

java.lang.Object
io.github.jbastgen.stemma.app.ui.widget.SelectableText

public final class SelectableText extends Object
Makes the text in a part of the scene selectable with the mouse and copyable, which labels cannot do. The text of such a part is in TextFlows (a paragraph, a heading, a cell, a code block each); a drag selects from one point to another across them, a double click a word, a triple click a paragraph, and Ctrl/⌘ + C or the context menu copies it as plain text, one line per paragraph. The selection is drawn as a translucent layer above the text. Links keep working (a click on one is not the start of a selection).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    A property of a flow: text that goes before it when it is copied from its start (the bullet of a list item).
  • Constructor Summary

    Constructors
    Constructor
    Description
    SelectableText(javafx.scene.layout.Region content)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Takes the selection away (for example before the text is replaced).
    static javafx.scene.text.TextFlow
    flow(String text, double size, int weight, String color)
    A paragraph of plain text as a flow that SelectableText can select.
    javafx.scene.layout.Region
    The node to put into the scene: the content with the layer of the selection above it.
    The selected text as plain text, one line per paragraph; empty when nothing is selected.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PREFIX

      public static final String PREFIX
      A property of a flow: text that goes before it when it is copied from its start (the bullet of a list item).
      See Also:
  • Constructor Details

    • SelectableText

      public SelectableText(javafx.scene.layout.Region content)
      Parameters:
      content - the rendered text blocks; every text flow in it can be selected
  • Method Details

    • node

      public javafx.scene.layout.Region node()
      The node to put into the scene: the content with the layer of the selection above it.
    • flow

      public static javafx.scene.text.TextFlow flow(String text, double size, int weight, String color)
      A paragraph of plain text as a flow that SelectableText can select.
    • clear

      public void clear()
      Takes the selection away (for example before the text is replaced).
    • selectedText

      public String selectedText()
      The selected text as plain text, one line per paragraph; empty when nothing is selected.