senleft
senleft

Reputation: 511

JavaFx HTMLEditor doesn't take all free size on the container

I try to set javafx HTMLEditor to get all free size on the container. The next is the source code.

public class HtmlEditorTest extends Application {

@Override
public void start(Stage stage) {
    stage.setTitle("HTMLEditor Sample");
    stage.setWidth(400);
    stage.setHeight(300);
    final HTMLEditor htmlEditor = new HTMLEditor();
    htmlEditor.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    MigPane migPane = new MigPane("fill, debug", "[fill]", "fill");
    migPane.add(htmlEditor);
    Scene scene = new Scene(migPane);
    stage.setScene(scene);
    stage.show();
}

public static void main(String[] args) {
    launch(args);
}
}

If I'll replace HTMLEditor with TextArea I get the expected behaviour. You may see result here

setting htmlEditor.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE) not solved the problem (based on this answer. As you may see on the picture I use MigPane in debug mode. And actually the TextArea and HTMLEditor taking the whole container free space. However HTMLEditor text area and scroll bar don't take the free space within HTMLEditor. How I may fix this problem?

Upvotes: 3

Views: 810

Answers (1)

senleft
senleft

Reputation: 511

The next addition solved this issue.

    WebView webview = (WebView) editor.lookup("WebView");
    GridPane.setHgrow(webview, Priority.ALWAYS);
    GridPane.setVgrow(webview, Priority.ALWAYS);

Upvotes: 5

Related Questions