nidi3 / graphviz-java

Use graphviz with pure java
Apache License 2.0
937 stars 107 forks source link

Screen flicker when running application #165

Closed julioz closed 4 years ago

julioz commented 4 years ago

Hi, first of all thanks for this project, it has been very useful.

I have built an application on top of it, which renders ER diagrams using graphviz by sourcing a database schema file. Check the code here.

There are two output branches on that app, one that spits out a text representation (in the DBML form) and another one that uses graphviz-java to output Dot/Svg/Png files.

What I (and other users) noticed is that, when running the graphviz-java path, my entire screen flickers for a brief moment (in other words, it blinks in black and then back to normal).

FWIW, I'm on a MacBook with MacOS Catalina 10.15.4 (19E287).

Since the idea for my project is to be run quite frequently (many times a day), the flicker starts to get a tad annoying.

I glanced over the other issues in this repo but couldn't find references. Can you please advise on how to prevent it?

nidi3 commented 4 years ago

Hi there I noted this too (also on Mac) and I suspect it has to do with the Graal Javascript engine. But I haven't investigated on this yet.

nidi3 commented 4 years ago

The cause was using AWT classes without drawing on the screen. Using headless mode fixes this in version 0.16.2.

nidi3 commented 4 years ago

Btw. as you're using kotlin, you might be interested in using graphviz-kotlin?

jeremydouglass commented 4 years ago

What is (or where is) graphviz-kotlin?

julioz commented 4 years ago

Excellent, thank you very much for the quick turnaround. I verified the fix for this 👍


I have plans on trying out graphviz-kotlin soon, but for the first releases I preferred the java API due to the extensive documentation in the PRs/issues of this repo. Now that FloorPlan has a somewhat covered usecase, we could try replacing the java bindings with kt ones.

nidi3 commented 4 years ago

graphviz-kotlin is a kotlin DSL for graphviz. It's here: https://github.com/nidi3/graphviz-java/tree/master/graphviz-kotlin 😄 And here https://github.com/nidi3/graphviz-java#kotlin-dsl

If there are any questions or suggestions about it, feel free to communicate them.