Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8123592

Label wrapped text cuts off unexpectedly with non-default font



    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
    • Environment:

      Windows 7 64-bit, JavaFX 8.0.0-ea-b92


      Run the included source, and notice that the Text within the red outline is cut off prematurely with an ellipsis. This does not occur with the default font, but it might be just coincidence.

      package hs.mediasystem;

      import java.util.Map;
      import java.util.WeakHashMap;

      import javafx.application.Application;
      import javafx.beans.binding.BooleanExpression;
      import javafx.beans.property.SimpleStringProperty;
      import javafx.beans.property.StringProperty;
      import javafx.collections.ObservableList;
      import javafx.scene.Node;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.control.ListView;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.ColumnConstraints;
      import javafx.scene.layout.GridPane;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.Pane;
      import javafx.scene.layout.Priority;
      import javafx.scene.layout.RowConstraints;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class TextFlowSample extends Application {
        private StringProperty plot = new SimpleStringProperty("When the coach of the France soccer team is killed by a poisoned dart in the stadium in the end of a game, and his expensive and huge ring with the diamond Pink Panther disappears, the ambitious Chief Inspector Dreyfus assigns the worst police inspector Jacques Clouseau to the case.");

        public static void main(String[] args) {

        public void start(Stage stage) throws Exception {
          HBox hbox = new HBox();

          hbox.setStyle(" -fx-font-family: \"Arial\"; -fx-font-size: 16px; -fx-font-weight: normal;");

          BorderPane borderPane = new BorderPane() {{
            setTop(new VBox() {{

            setCenter(new GridPane() {{
              GridPaneUtil.configure(this, new double[] {60, 40}, new double[] {100});


              add(new VBox() {{
              }}, 0, 0);

              add(new VBox() {{
              }}, 1, 0);

            setBottom(new HBox() {{

          add(borderPane, "description-area", 6, createPlotBlock());

          ListView<String> listView = new ListView<>();

          listView.getItems().add("Some title");

          hbox.getChildren().addAll(borderPane, listView);

          stage.setScene(new Scene(hbox));


        protected Pane createPlotBlock() {
          Node plotField = createPlotField();
          VBox.setVgrow(plotField, Priority.ALWAYS);

          return createTitledBlock("PLOT", plotField, plot.isNotEqualTo(""));

        protected Node createPlotField() {
          return new Label() {{
            getStyleClass().addAll("field", "plot");

        protected Pane createTitledBlock(final String title, final Node content, final BooleanExpression visibleCondition) {
          return new VBox() {{
            getChildren().add(new Label(title) {{

            if(visibleCondition != null) {
            setStyle("-fx-border-color: red; -fx-border-width: 2px");

        private final Map<Node, Double> orderMap = new WeakHashMap<>();

        public boolean add(Pane mainPane, String areaName, double order, Node node) {
          Pane pane = (Pane)mainPane.lookup("#" + areaName);

          if(pane == null) {
            return false;

          ObservableList<Node> children = pane.getChildren();
          int insertPosition = 0;

          for(; insertPosition < children.size(); insertPosition++) {
            Node child = children.get(insertPosition);

            if(orderMap.get(child) > order) {

          children.add(insertPosition, node);
          orderMap.put(node, order);

          return true;

        public static class GridPaneUtil {
          public static void configure(GridPane gridPane, double[] columns, double[] rows) {
            for(double column : columns) {
              ColumnConstraints constraints = new ColumnConstraints();



            for(double row : rows) {
              RowConstraints constraints = new RowConstraints();



          public static GridPane create(double[] columns, double[] rows) {
            GridPane gridPane = new GridPane();

            configure(gridPane, columns, rows);

            return gridPane;


          Issue Links



              fheidric Felipe Heidrich (Inactive)
              jhendrikx John Hendrikx
              0 Vote for this issue
              4 Start watching this issue