Communication between two JFrame
running in two different JVM! No, i would never ever give an attention to do what you are trying to achieve at all. This approach is taking memory as much as twice, require immature yet complex way of doing things making the whole process not only slow, but less than making good sense.
The way we should design the process:
- Use one
JFrame
- if required to change content pane with different view: Make use of
CardLayout
- If required to view more than one component at once in Stack, one above the other make use of
JLayeredPane
: which is more perfect for your use case
- For a continuous and progressive task which require background execution and updating of the GUI on ready portion of task make use of
SwingWorker
Now discussing about how to use them to achieve your goal will take a huge space and time cost, hence out of the scope of your question. Please, check out this article one by one:
- Using multiple JFrame: good vs bad
- How to use Layered Pane
- Worker threads and SwingWorker
Edit:
Yes, i do have a solution for you which will take two additional threads:
one to write the new image of screen shots to a file location from the JVM with Frame
: use ImageIO.write()
. I would name the file with current time and appropriate image extension(jpg, png etc) : currentTimestamp.jpg
currentTimeStamp.png
Another thread with the JVM containing Results
frame to check if a new image file is available to work with, if so read it using ImageIO.read()
and then remove from the file location.
Check out: How to use ImageIO to read and write