Sidonie,

It is possible to run two NetLogo instances with the GUI at the same time, 
but it's unfortunately a little complicated.  Because the `App.app` entry 
point that you'd usually use to startup the GUI is a static variable, it's 
not as simple as calling `App.app.open()` twice, since you'd just overwrite 
the first model with the second.

One option would be to investigate launching separate processes to run each 
NetLogo GUI.  If you start a wholly separate process with a different JVM 
class loader, each will get its own static variables, so you can then run 
your models through the normal `App.app.open()` method.  You then have to 
deal with the complexity of managing separate processes, though.

Another option might be to look at how the LevelSpace extension 
<https://github.com/NetLogo/LevelSpace> runs separate models.  It looks 
like it runs all models through headless workspaces (which are easy to 
setup multiple instances of 
<https://github.com/LaCuneta/NetLogo-ControllingAPI-Sample/blob/master/src/main/SampleHeadless.scala#L31-L51>),
 
but LevelSpace can also display a GUI for the child models with some custom 
code.  This code is spread out over a few classes, but some good starting 
points to look at might be the `GUIChildModel` class and the `GUIPanel` 
class.

I hope that helps, good luck with your project.

-Jeremy

On Wednesday, September 25, 2019 at 8:07:29 AM UTC-5, sidonie derenoncourt 
wrote:
>
>
> Hello, 
>
> I used to control a Netlogo instance with GUI from Java. 
> But now I would like to control 2 instances (with GUI) from one Java 
> program.
>
> Is it possible ? How can I do ?
>
> Thanks a lot
>

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netlogo-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netlogo-devel/a1b0df28-82bc-4b1f-ae19-cf7063ed3fb6%40googlegroups.com.

Reply via email to