Skip to content

Question: How to show whole text when text area is added to scene #1243

@PavelTurk

Description

@PavelTurk

Let's assume there is an unknown text with some styles.

Now, I need

  1. to create text area (InlineCssTextArea) with fixed width (for example, 500 pixels)
  2. to add text to it with styles
  3. to find whole document height
  4. to make text area height equal to document height
  5. to add text area to scene to show whole document without scrollbars.

As it is seen the problem is that I need whole document height when I only add text area to scene. I tried this code:

var messageArea = new InlineCssTextArea();
var scrollPane = new VirtualizedScrollPane(messageArea);
messageArea.totalHeightEstimateProperty().addListener((ov, oldV, newV) -> scrollPane.setMinHeight((double) newV));

This code works, but the problem is that when messageArea becomes visible it has one height and later its height is changed and user sees flickering. I tried to add

messageArea.setAutoHeight(true);
messageArea.applyCss();
messageArea.requestLayout();

But it didn't help. Could anyone say how to do it if it is possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions