0

I'm currently working on a javafx project and I keep running into the problem with blurry nodes when they are added to a Stackpane.

I have tried using setSnapToPixel(true) on the Stackpane but I still end up with a blurry result.

Stackpane pane = new Stackpane(new NodeConsole(15)); //I get a blurry result

primaryStage.setScene(new Scene(pane));
primaryStage.show();

When I use a Group I get this: Clear Image

When I use a Stackpane I get this: Blurry Image

  • 1
    Is `NodeConsole` a standard _JavaFX_ class? I am not familiar with it and I can't find it using _Google_. – Abra Sep 09 '19 at 17:37
  • @abra NodeConsole is a custom node I have built but I did not link the class because it is a lot of uncommented code and appears to not be a part of the issue because when I change to a group I change nothing in the class. – Java Freshman Sep 09 '19 at 17:49
  • To me, your _blurry image_ looks like it is anti-aliased whereas the _clear image_ appears not to be. I don't think `StackPane` uses anti-aliasing by default. Does class `NodeConsole` ? – Abra Sep 09 '19 at 17:54
  • @abra with javafx anti-aliasing control is only given to the scene but nodes have double-precision meaning I put a node between two pixels like setting x to 1.3, but in this case I suspect the Stackpane is doing this on its own trying to align nodes to the center and setSnapToPixel(true) is supposed to combat this but it's not working. – Java Freshman Sep 09 '19 at 17:58
  • I think you should try to post a [mcve]. – Abra Sep 09 '19 at 18:21
  • @abra Alright I'll work on that now, thanks for your help. – Java Freshman Sep 09 '19 at 18:30
  • A problem with scaling `Image` data is known and there is already a thread about this (https://stackoverflow.com/questions/16089304/javafx-imageview-without-any-smoothing) . Otherwise I've no idea what may cause the issue. It's almost certainly something in your custom node. – fabian Sep 09 '19 at 18:58
  • @fabian it seems to be some sort of problem with either the ScrollPane or some sort of bug as there are a few that cause blurry nodes and I am just going to use a group to contain the node and the StackPane to save myself the trouble of spending any more hours trying to debug this issue, but thanks for offering a suggestion. – Java Freshman Sep 09 '19 at 19:36

0 Answers0