@FXML private void gotoNP(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { if (go == false) { npView.setVisible(true); mView.toBack(); timeProgress.setTextFill(Color.WHITE); Stage stage = (Stage) root.getScene().getWindow(); stage.setResizable(true); btnPaFull.setImage(new Image("icon/Full_button/full.png")); go = true; } else { if (play == true) { Stage stage = (Stage) root.getScene().getWindow(); if (full == false) { stage.setFullScreen(true); btnPaFull.setImage(new Image("icon/Full_button/full_off.png")); full = true; } else { stage.setFullScreen(false); btnPaFull.setImage(new Image("icon/Full_button/full.png")); full = false; } } } } }
@Test public void testConceptNewJump() { // given Set<Node> newButtons = conceptMapView.lookupAll(".newBtnTop"); Node firstNewButton = newButtons.iterator().next(); moveTo(firstNewButton).press(MouseButton.PRIMARY).release(MouseButton.PRIMARY); Node concept = conceptMapView.lookup(".concept"); double expectedX = concept.getLayoutX() + concept.getTranslateX(); double expectedY = concept.getLayoutY() + concept.getTranslateY(); // when super.interact( () -> { stage.setFullScreen(false); stage.setWidth(stage.getWidth() - 40); stage.setHeight(stage.getHeight() - 40); }); // then double actualX = concept.getLayoutX() + concept.getTranslateX(); double actualY = concept.getLayoutY() + concept.getTranslateY(); assertEquals(expectedX, actualX, 50); assertEquals(expectedY, actualY, 50); }
private void setupStageLocation(Stage stage) { ObservableList<Screen> screens = Screen.getScreens(); Screen screen = screens.size() <= screenNumber ? Screen.getPrimary() : screens.get(screenNumber); Rectangle2D bounds = screen.getBounds(); boolean primary = screen.equals( Screen.getPrimary()); // WORKAROUND: this doesn't work nice in combination with full // screen, so this hack is used to prevent going fullscreen when // screen is not primary if (primary) { stage.setX(bounds.getMinX()); stage.setY(bounds.getMinY()); stage.setWidth(bounds.getWidth()); stage.setHeight(bounds.getHeight()); stage.setFullScreen(true); } else { stage.setX(bounds.getMinX()); stage.setY(bounds.getMinY()); stage.setWidth(bounds.getWidth()); stage.setHeight(bounds.getHeight()); stage.toFront(); } }
/** * Click and Hold to make window draggable * * @param event */ public void handleAppMouseClick_Hold(MouseEvent event) { Stage stage = OnlineQuizzingApp.getInstance().getStage(); xOffset = event.getSceneX(); yOffset = event.getSceneY(); if (event.getButton().equals(MouseButton.PRIMARY)) { if (event.getClickCount() == 2) { if (stage.isFullScreen()) { stage.setFullScreen(false); } else { stage.setFullScreen(true); } } } }
@InvokableAction( name = "Toggle fullscreen", category = "general", description = "Activate/deactivate fullscreen mode", alternatives = "fullscreen,maximize", defaultKeyMapping = "ctrl+shift+f") public static void toggleFullscreen() { Platform.runLater( () -> { Stage stage = JaceApplication.getApplication().primaryStage; stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); stage.setFullScreen(!stage.isFullScreen()); }); }
@FXML private void gotoMain(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { btnPaFull.setImage(new Image("icon/Go_button/goNP.png")); timeProgress.setTextFill(Color.BLACK); Stage stage = (Stage) root.getScene().getWindow(); if (stage.isFullScreen() == true) { stage.setFullScreen(false); } mView.setVisible(true); npView.toBack(); stage.setResizable(false); go = false; } }
public void start(Stage primaryStage) { try { screenBounds = Screen.getPrimary().getVisualBounds(); Group root = new Group(); Scene scene = new Scene(root, screenBounds.getWidth(), screenBounds.getHeight()); root.getChildren().add(new MainMenu(primaryStage).bigBox); scene.setFill(Color.WHITE); primaryStage.setScene(scene); primaryStage.initStyle(StageStyle.UNDECORATED); primaryStage.setFullScreen(true); primaryStage.show(); } catch (Exception e) { e.printStackTrace(); } }
@Override public void start(Stage stage) throws IOException { this.stage = stage; List<User> p = new ArrayList<User>(); User u1 = new User("alfred", "*****@*****.**"); User u2 = new User("björn", "*****@*****.**"); User u3 = new User("klaus", "*****@*****.**"); User u4 = new User("lukas", "*****@*****.**"); p.add(u1); p.add(u2); p.add(u3); p.add(u4); Experiment experiment = new Experiment(u1, new FocusQuestion("How dare you?", u1), 4, false, false); experiment.addParticipant(u1); experiment.addParticipant(u2); experiment.addParticipant(u3); experiment.addParticipant(u4); map = new ConceptMap(experiment); ConceptMapViewBuilder builder = new ConceptMapViewBuilder(); ObservableConceptFactory conceptFactory = new ObservableConceptFactory(); ConceptViewBuilder conceptBuilder = new ConceptViewBuilder(map, conceptFactory); scene = builder.withConceptViewBuilder(conceptBuilder).withConceptMap(map).build(); controller = builder.getController(); conceptMapView = (ConceptMapView) scene.getRoot(); stage.setScene(scene); stage.setFullScreen(true); stage.show(); }