Altair RISE
A program to recognize and reward our most engaged community members
Nominate Yourself Now!
Home
Discussions
Community Q&A
"Separate Threads for two independent operators using Java Swing"
Ghostrider
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.
Find more posts tagged with
AI Studio
Java
Developer
Accepted answers
All comments
land
Hi,
you could render into a buffered image and after finishing pass the buffered image to the awt event thread to paint it.
Greetings,
Sebastian
Ghostrider
That's a very good idea. I've never tried that before, but thanks for the suggestion. I'll look into it.
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.
land
Hi,
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
Quick Links
All Categories
Recent Discussions
Activity
Unanswered
日本語 (Japanese)
한국어(Korean)
Groups