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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8u301
    • Fix Version/s: None
    • Component/s: javafx
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      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


        Attachments

        1. Capture.PNG
          Capture.PNG
          54 kB
        2. Starter.java
          0.9 kB
        3. styles.css
          0.4 kB

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: