更新时间:2023-11-18 22:21:10
Basically, you can run each window in a separate process (use the answer here to see how to implement JavaProcess
which is used below):
public class Tiles {
public static void main(String[] args) {
LwjglApplicationConfiguration configForTiles = new LwjglApplicationConfiguration();
TilePresets tilesWindow = new TilePresets();
LwjglApplication tiles = new LwjglApplication(tilesWindow, configForTiles);
}
}
Wrapper.java
is the main entry point. It's where launching both windows occurs:
public class Wrapper {
public static void main(String[] args) {
// Launch mapWindow regularly
LwjglApplicationConfiguration configForMap = new LwjglApplicationConfiguration();
MapMaker mapWindow = new MapMaker();
LwjglApplication map = new LwjglApplication(mapWindow, configForMap);
try {
int res = JavaProcess.exec(Tiles.class); // Where the second window is shown
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Credit alert! I had a similar question and I found this solution somewhere, but I can't remember where. I'll post the source here when I find it.
Edit: Credit goes to the person from which I got the idea for this solution.