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; } }
public CustomLayout() { // Earth Viewer takes two parameters, one is the desired radius of your mini Earth // and one is the desired radius of your large Earth // This was done so that each client could easily size the Earth to fit in with their GUI earthViewer = new EarthViewer(70, 250); // Start rotate will put the earthViewer object in an automatic and continuous rotation (this is // for the mini view) earthViewer.startRotate(); initTopBar(); initLeftBar(); initCenter(); this.setTop(topBar); this.setLeft(leftBarGrid); }
private void initLeftBar() { leftBarGrid.setHgap(10); leftBarGrid.setVgap(10); leftBarGrid.setPadding(new Insets(0, 0, 0, 0)); leftBarGrid.add(earthViewer.getMiniEarth(), 0, 0); }