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

CSS relative -fx-font-size of child causes change of parent dimensions

XMLWordPrintable

    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      Java 8u301


      A DESCRIPTION OF THE PROBLEM :
      Hello!

      We have serious JavaFX problems with our application since the release of Java 8u301. The problems don't exists in Java 8u291. We suspect that they are related to the fix of JDK-8204568 (Relative CSS-Attributes don't work all time).

      We provide the source code below. If you run it with 8u291 and then with 8u301 you will see, that the button/radio button are much bigger in 8u301 while the font size is the same. We expect the the size of the button/radio button to be unchanged.




      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.RadioButton;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class Starter extends Application {

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

          @Override
          public void start(final Stage primaryStage) {

              primaryStage.setResizable(true);

              Button button = new Button("Button " + System.getProperty("java.version"));
              RadioButton radioButton = new RadioButton("RadioButton " + System.getProperty("java.version"));

              VBox vbox = new VBox(button, radioButton);
              vbox.getStyleClass().add("container");

              Scene scene = new Scene(vbox);

              scene.getStylesheets().add(getClass().getResource("/styles.css").toExternalForm());

              primaryStage.setScene(scene);

              primaryStage.show();
          }
      }

      ---- styles.css ----
      .root {
          -fx-font-size: 12px;
      }

      .container {
          -fx-spacing: 2em;
          -fx-pref-width: 30em;
          -fx-pref-height: 20em;
      }

      .button,
      .radio-button {
          -fx-min-width: 17em;
          -fx-pref-width: 17em;
          -fx-max-width: 17em;

          -fx-min-height: 3em;
          -fx-pref-height: 3em;
          -fx-max-height: 3em;
      }

      .button .text,
      .radio-button .text{
          -fx-font-size: 1.5em;
      }

      .radio-button {
          -fx-border-color: red;
      }


      ---------- END SOURCE ----------

      FREQUENCY : always


        1. styles.css
          0.4 kB
        2. Starter.java
          0.9 kB
        3. -fx-font-size-button-behavior.png
          -fx-font-size-button-behavior.png
          37 kB
        4. Capture.PNG
          Capture.PNG
          54 kB

            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: