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

SwingNode rendered blurry when reflection effect is applied

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • tbd
    • jfx17
    • javafx
    • None

      Running the following sample on my MacBook Pro with a Retina Display

      package fxsample;

      import javax.swing.JButton;
      import javax.swing.SwingUtilities;

      import javafx.application.Application;
      import javafx.embed.swing.SwingNode;
      import javafx.scene.Scene;
      import javafx.scene.effect.Reflection;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class Blim extends Application {

      @Override
      public void start(Stage stage) {
      final SwingNode swingNode = new SwingNode();

      Reflection reflection = new Reflection();
      reflection.setFraction(0.3);
      reflection.setTopOffset(20);


      // SepiaTone s = new SepiaTone();
      // swingNode.setEffect(s);
      //
      // DropShadow d = new DropShadow();
      // swingNode.setEffect(d);

      createAndSetSwingContent(swingNode);

      StackPane pane = new StackPane();
      pane.getChildren().add(swingNode);
      pane.setEffect(reflection);

      stage.setScene(new Scene(pane, 100, 50));
      stage.show();
      }

      private void createAndSetSwingContent(final SwingNode swingNode) {
      SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
      swingNode.setContent(new JButton("Click me!"));
      }
      });
      }

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

      }

      results in a blurry text. It feels as if it renders a normal DPI-Version instead of the HiDPI-Version of the SwingNode. SwingNode renders perfectly if there other effects applied

        1. without-effect.png
          without-effect.png
          78 kB
        2. with-effect.png
          with-effect.png
          80 kB
        3. reflection-bug.png
          reflection-bug.png
          438 kB

            psadhukhan Prasanta Sadhukhan
            tschindl Tom Schindl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: