Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which thread for non-GUI graphics?

Tags:

java

graphics

For the first time, I'm writing a Java application that is graphics-intensive without a GUI. It generates images by creating a BufferedImage and working with its Graphics2D object. Images are written to files using ImageIO.write.

I need to decide whether to work in the main thread, or the Event Dispatch Thread.

In favor of the EDT, I would do all the graphics updates in the EDT if I were writing a GUI.

In favor of the main thread, the application will compute continuously for the whole time it is running, without any user interaction to break things up.

like image 795
Patricia Shanahan Avatar asked Aug 23 '26 09:08

Patricia Shanahan


1 Answers

Which thread for non-GUI graphics?

Non EDT is what I would have guessed (and the way I've always coded it).

But could you confirm, does the app. have a GUI?

No, the app does not have a GUI. It needs to be able to run unattended.

That settles it, forget the EDT & use whatever Thread you like (including the default one given to the app.).

like image 54
Andrew Thompson Avatar answered Aug 25 '26 00:08

Andrew Thompson