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

Different default 'font' value for lableleds between css ref and getCssMetaData

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • javafx
    • jdk1.8.0 b85

      Now the actual value is new Font(12), but in css ref it is 'null'.
      Please, update css ref.

      import com.sun.javafx.runtime.VersionInfo;
      import java.util.HashMap;
      import java.util.Map;
      import java.util.concurrent.TimeUnit;
      import java.util.logging.Level;
      import java.util.logging.Logger;
      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.css.CssMetaData;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.AnchorPane;
      import javafx.stage.Stage;

      public class Main extends Application {

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

          @Override
          public void start(Stage stage) throws Exception {
              setUserAgentStylesheet(STYLESHEET_MODENA);
              stage.setTitle(VersionInfo.getRuntimeVersion());
              stage.setScene(createScene());
              
              Platform.runLater(new Runnable() {
                  @Override
                  public void run() {
                      try {
                          TimeUnit.SECONDS.sleep(1);
                      } catch (InterruptedException ex) {
                          Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                      }
                      Button b = new Button();

                      Map<String, CssMetaData> styles = new HashMap<>();
                      for (CssMetaData data : b.getCssMetaData()) {
                          styles.put(data.getProperty(), data);
                      }

                      CssMetaData data = styles.get(getTestedStyle());

                      System.out.println("Initial value " + data.getInitialValue(b));
                  }
              });
              
              stage.show();
              
          }

          private Scene createScene() {
              return new Scene(new AnchorPane());
          }

          private String getTestedStyle() {
              return "-fx-font";
          }
      }

            dgrieve David Grieve
            dzinkevi Dmitry Zinkevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: