The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
"Separate Threads for two independent operators using Java Swing"
Ghostrider
Member Posts: 60 Contributor II
I have two separate operators which open a JFrame and do some rendering. The rendering is very CPU consuming and I would like to run both on a separate threads. The two operators and JFrames are completely independent. Is there any way to run the rendering on separate threads? If I recall correctly, there's only 1 swing thread. Just seeing if there's anything that can be done to get around that restriction.
0
Answers
you could render into a buffered image and after finishing pass the buffered image to the awt event thread to paint it.
Greetings,
Sebastian
Update: Is there an example of drawing to bufferedImage within RapidMiner? I know RapidMiner uses JFreeChart and I can see if-statements for bufferedImage drawing in JFreeChart's XYItemRenderer object.
you can just retrieve the graphics object from a buffered image and render into it using the paint Component method as you would do for a JPanel.
By the way: It is generally discouraged to access any awt methods inside operators. This would cause the process to crash in server or command line mode.
I would suggest storing the results in an IOObject, registering a renderer for this result object and then you can take a look at the object instead of outputs created during the process. This way it is much easier to maintain results for documentation, you can even report them.
Greetings,
Sebastian