Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8190109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:30:46+00:00 2026-06-07T03:30:46+00:00

I´m just facing a little issue that I can´t solve by myself. I try

  • 0

I´m just facing a little issue that I can´t solve by myself.
I try to place a vBox including a TextField and a HTML-Editor in my BorderPane, but
the full space is not used. Another problem is that if I shrink the window, the html-editor
overlaps with my left option window.

enter image description here

private void initEditor()
{
editor = new HTMLEditor();
editor.setId("editor");
editor.lookup(".top-toolbar").setDisable(true);
editor.lookup(".top-toolbar").setManaged(false);
((ToolBar) editor.lookup(".bottom-toolbar")).getItems().addAll(FXCollections.observableArrayList(((ToolBar)editor.lookup(".top-toolbar")).getItems()));

editorBox = new VBox();
TextField field = new TextField();
field.setPrefHeight(36);
field.setId("editor-title");
editorBox.setFillWidth(true);
editorBox.getChildren().addAll(field, editor);
    root.setCenter(editorBox);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:30:48+00:00Added an answer on June 7, 2026 at 3:30 am

    OK, so a few things going wrong here, I’ll try to address them provide some advice and a sample solution.

    I try to place a vBox including a TextField and a HTML-Editor in my BorderPane, but the full space is not used.

    You need to use the VBox.setVgrow(editor, Priority.ALWAYS) method to get the HTMLEditor to take up any extra space in the VBox. Also, make sure that the HTMLeditor has an unbounded max height so that it can grow to fit the available area, for example editor.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE). Calling editorBox.setFillWidth(true) is redundant as the default value for the fillWidth property is true.

    But even if you do all that, (as of 2.2b13) there is a bug in WebPane sizing which will cause you problems. Internally the WebPane is implemented as a GridPane containing the Toolbar and an editable WebView. By default, WebView has a preferred size of 800×600. The HtmlEditor control does not set the GridPane constraints for the WebView to allow it to be sized past it’s preferred size.

    To work around this, you can lookup the WebView via a css lookup after it has been added to an active Scene and adjust the GridPane constraints manually. Here is some code to do that:

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

    I shrink the window, the html-editor overlaps with my left option window.

    Explicitly set the minimum width setting for the center pane in your BorderPane so that it won’t overflow over the outer edge Panes.

    editorBox.setMinSize(0, 0);
    

    You need to do this because the BorderPane documentation states:

    BorderPane does not clip its content by default, so it is possible that childrens’ bounds may extend outside its own bounds if a child’s min size prevents it from being fit within it space.


    As an aside the lookup calls in your code are suspicious. Normally you can’t lookup nodes by css ID until the node has been added to an active scene on a displayed stage and the JavaFX system has had a chance to run a CSS layout pass on the node – otherwise the lookup will just return null.


    For debugging JavaFX layout issues, the ScenicView application is invaluable.


    Here is a complete example to generate a layout similar to the image linked in your question, but without the issues you mention.

    import com.javafx.experiments.scenicview.ScenicView;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.*;
    import javafx.scene.layout.*;
    import javafx.scene.web.*;
    import javafx.stage.*;
    
    public class HtmlEditorInBorderPane extends Application {
      public static void main(String[] args) { launch(args); }
      @Override public void start(final Stage stage) throws IOException {
        // option pane.
        VBox optionPane = new VBox(10);
        MenuBar menuBar = new MenuBar();
        menuBar.getMenus().addAll(new Menu("School"), new Menu("Social"), new Menu("Network"));
        TreeItem<String> root = new TreeItem<>("Private Notes");
        root.setExpanded(false);
        root.getChildren().addAll(new TreeItem<>("Layout"), new TreeItem<>("is not"), new TreeItem<>("easy"));
        TreeView<String> notes = new TreeView<>(root);
        optionPane.getChildren().addAll(menuBar, new Label("Kaiser Notes"), notes);
        optionPane.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
    
        // editor pane.
        HTMLEditor editor = new HTMLEditor();
        VBox editorBox = new VBox(10);
        TextField textField = new TextField();
        editorBox.getChildren().addAll(textField, editor);
        editorBox.setStyle("-fx-background-color: mistyrose; -fx-padding: 10;");
        editor.setHtmlText(getSampleText());
    
        // option layout constraints
        VBox.setVgrow(notes, Priority.ALWAYS);
    
        // editor layout constraints
        textField.setMinHeight(Control.USE_PREF_SIZE); // stop the textfield from getting squashed when the scene is sized small.
        VBox.setVgrow(editor, Priority.ALWAYS);        // tells the editor to fill available vertical space.
        editorBox.setMinSize(0, 0);                    // stops the editor from overflowing it's bounds in a BorderPane.
    
        // layout the scene.
        BorderPane layout = new BorderPane();
        layout.setLeft(optionPane);
        layout.setCenter(editorBox);
        stage.setScene(new Scene(layout));
        stage.show();
    
        // addition of static layout grow constraints for the htmleditor embedded webview.
        WebView webview = (WebView) editor.lookup("WebView");
        GridPane.setHgrow(webview, Priority.ALWAYS);  // allow the webview to grow beyond it's preferred width of 800.
        GridPane.setVgrow(webview, Priority.ALWAYS);  // allow the webview to grow beyond it's preferred height of 600.
      }
    
      // get some dummy lorem ipsum sample text.
      private String getSampleText() throws IOException {
        StringBuilder builder = new StringBuilder();
        try (BufferedReader in = new BufferedReader(new InputStreamReader(new URL("http://www.lorem-ipsum-text.com/").openStream()))) {
          String string;
          while ((string = in.readLine()) != null) {
            builder.append(string);
          }
        }
        return builder.toString();
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm facing a design challenge that I just can't seem to solve in a
I'm facing a little problem I can't seem to solve. The problem is in
I'm just programming a little function that toggles a content by fading it in
hey guys, i'm facing a little annoying bug that's in my case not really
I am just facing a problem,can not able to overcome(make be lack of proper
I am just facing the issue at open new browser at each click event
I am facing a strange issue. My code runs just fine from Netbeans or
I'm just starting with the Youtube API and I'm facing something that I cannot
I am just facing trouble to sort out the query I need. I have
just had a general question about how to approach a certain problem I'm facing.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.