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

Text in subscene embedded in another subscene appears blurry

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • jfx11, 8, jfx17, jfx21, jfx22
    • javafx
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      win8 and linux/jdk 17

      A DESCRIPTION OF THE PROBLEM :

      I found that placing a subscene into another subscene would make the text in the sub-subscene so blurry. I had tried to set the cache for the subscene but did not improve it.Below is the minimum demo and the picture to show the problem.
       I am using jdk version 17 and jfx version 19.

      I tried to add sub-subscene root node directly without using Subscene, and the text was no longer blurry.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run demo code and.compare the upper text and lower text.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The text in the upper area looks as clear as the text in the lower area
      ACTUAL -
       The text in the lower area looks blurry

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.geometry.Insets;
      import javafx.geometry.Pos;
      import javafx.scene.Scene;
      import javafx.scene.SceneAntialiasing;
      import javafx.scene.SubScene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Label;
      import javafx.scene.control.ScrollPane;
      import javafx.scene.layout.*;
      import javafx.scene.paint.Color;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      public class TestSubSceneApplication extends Application {

          @Override
          public void start(Stage stage) {
              HBox hBox = new HBox();
              hBox.setPrefHeight(300);
              hBox.setBackground(new Background(new BackgroundFill(Color.YELLOW,null,null)));
              Label label = new Label("123");
              label.setStyle("-fx-font-size:30px;");
              Button button = new Button("testButton");
              button.setStyle("-fx-font-size:30px;");
              Text text = new Text("test");
              text.setStyle("-fx-font-size:30px;");
              hBox.setSpacing(50);
              hBox.setAlignment(Pos.CENTER);
              hBox.getChildren().addAll(label, button, text);

              StackPane stackPane = new StackPane();
              Scene scene = new Scene(stackPane, 1000, 1000);

              VBox vBox = new VBox();
              vBox.setSpacing(10);
              //borderPane.setPrefSize(1600,1600);
              vBox.setCache(false);
              vBox.setSnapToPixel(false);
              vBox.setCacheShape(false);
              vBox.getChildren().add(hBox);
              vBox.setScaleX(0.81231312);
              vBox.setScaleY(0.82341123);

              SubScene subScene = new SubScene(vBox, 1000, 700);
              stackPane.getChildren().add(subScene);

              StackPane content = new StackPane();
              HBox subHBox = new HBox();
              subHBox.setPrefHeight(300);
              SubScene bottomSubScene = new SubScene(content, 1000, 350);
              subHBox.setBackground(new Background(new BackgroundFill(Color.YELLOW,null,null)));
              Label subLabel = new Label("123");
              subLabel.setStyle("-fx-font-size:30px;");
              Button subButton = new Button("testButton");
              subButton.setStyle("-fx-font-size:30px;");
              Text subText = new Text("test");
              subText.setStyle("-fx-font-size:30px;");
              subHBox.getChildren().addAll(subLabel, subButton, subText);
              subHBox.setSpacing(50);
              subHBox.setAlignment(Pos.TOP_CENTER);
              content.getChildren().add(subHBox);
              content.setBackground(new Background(new BackgroundFill(Color.GREY,null,null)));
              //vBox.setPrefSize(500,600);
              //content.setScaleX(0.81231312);
              //content.setScaleY(0.82341123);
              vBox.getChildren().add(bottomSubScene);

              stage.setTitle("Test Demo");
              stage.setScene(scene);
              stage.setResizable(true);
              stage.show();
          }

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

      FREQUENCY : always


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

              Created:
              Updated: