public synchronized void switchEarthView() { // This method will switch between Earth "modes", the modes being either Mini or Large // Needs to be synchronized, since it will be removing and adding nodes while the program is // running // In my example, I am using BorderLayout and I switching between displaying the mini Earth in // the // left pane and the large Earth in the center. // The large Earth responds to scrolling, the mini Earth does not and should simply rotate // continuously. if (fullEarth) { centerGrid.getChildren().remove(0); leftBarGrid.getChildren().add(earthViewer.getMiniEarth()); initCenter(); fullEarth = false; } else { leftBarGrid.getChildren().remove(0); centerGrid.getChildren().add((earthViewer.getLargeEarth())); earthViewer.startEarth(); fullEarth = true; } }
private void initLeftBar() { leftBarGrid.setHgap(10); leftBarGrid.setVgap(10); leftBarGrid.setPadding(new Insets(0, 0, 0, 0)); leftBarGrid.add(earthViewer.getMiniEarth(), 0, 0); }