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

JavaFX TabPane header area size not changed if font size set in relative units

XMLWordPrintable

    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_112"
      Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
      Java HotSpot(TM) Client VM (build 25.112-b15, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 64-bit

      A DESCRIPTION OF THE PROBLEM :
      If root element style set to something like "-fx-font-size: 24px"), all nodes are resized as expected. If however a percentage or em-value is used, e.g. "-fx-font-size: 200%", the header area of a TabPane is not resized and clips the tab labels.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See source at
      https://gist.github.com/dmitryleskov/7b35c42484cbc852134687298e8eb738

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      TabPane header area properly resized to show tab labels
      ACTUAL -
      TabPane header area size stays uncheged, resulting in tab labels being clipped out.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package sample;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.*;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class Main extends Application {

          @Override
          public void start(Stage primaryStage) throws Exception {
              Tab tab1 = new Tab("Tab 1", new Button("Click me!"));
              Tab tab2 = new Tab("Tab 2",
                      new VBox(new Label("Label"),
                               new TextArea("Some text")
                      )
              );
              TabPane root = new TabPane(tab1, tab2);
              primaryStage.setScene(new Scene(root, 320, 200));
              primaryStage.show();
              // root.setStyle("-fx-font-size: 24px"); // This works
              root.setStyle("-fx-font-size: 200%"); // This does not
          }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Use absolute units

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: