package polling_station_dashboard.java; import javafx.fxml.FXML; import javafx.scene.layout.Pane; import javafx.stage.Stage; /** * Created by Vladimir Eliezer Tokarev on 28/05/2016. */ public class PollingStationDashboardController { private Stage currentStage; private boolean statusLogOpened = false; public void SetStage(Stage primaryStage) { this.currentStage = primaryStage; } private void setStatusLog(){ if (!statusLogOpened) { SetStatusLogSize(400); } else { SetStatusLogSize(-400); } statusLogOpened = !statusLogOpened; } private void SetStatusLogSize(int expansionWidth) { currentStage.setWidth(currentStage.getWidth() + expansionWidth); Pane statusLogGrid = (Pane) currentStage.getScene().lookup("#StatusLog"); statusLogGrid.setPrefWidth(expansionWidth); } @FXML private void OnStatusLogPressed() { setStatusLog(); } }