List of usage examples for javafx.stage Stage setY
public final void setY(double value)
From source file:org.jevis.jeconfig.JEConfig.java
/** * maximized the given stage//from w ww .j a va 2s.c o m * * @param primaryStage */ public static void maximize(Stage primaryStage) { Screen screen = Screen.getPrimary(); Rectangle2D bounds = screen.getVisualBounds(); primaryStage.setX(bounds.getMinX()); primaryStage.setY(bounds.getMinY()); primaryStage.setWidth(bounds.getWidth()); primaryStage.setHeight(bounds.getHeight()); }
From source file:spdxedit.PackageEditor.java
/** * Opens the modal package editor for the provided package. * * @param pkg The package to edit. * @param relatablePackages Packages to which the edited package may optionally have defined relationships * @param parentWindow The parent window. *///from ww w . ja va 2s. c o m public static void editPackage(final SpdxPackage pkg, final List<SpdxPackage> relatablePackages, SpdxDocumentContainer documentContainer, Window parentWindow) { final PackageEditor packageEditor = new PackageEditor(pkg, relatablePackages, documentContainer); final Stage dialogStage = new Stage(); dialogStage.setTitle("Edit SPDX Package: " + pkg.getName()); dialogStage.initStyle(StageStyle.DECORATED); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.setY(parentWindow.getX() + parentWindow.getWidth() / 2); dialogStage.setY(parentWindow.getY() + parentWindow.getHeight() / 2); dialogStage.setResizable(false); try { FXMLLoader loader = new FXMLLoader(NewPackageDialog.class.getResource("/PackageEditor.fxml")); loader.setController(packageEditor); Pane pane = loader.load(); Scene scene = new Scene(pane); dialogStage.setScene(scene); dialogStage.getIcons().clear(); dialogStage.getIcons().add(UiUtils.ICON_IMAGE_VIEW.getImage()); //Populate the file list on appearance dialogStage.setOnShown(event -> { try { final SpdxFile dummyfile = new SpdxFile(pkg.getName(), null, null, null, null, null, null, null, null, null, null, null, null); TreeItem<SpdxFile> root = new TreeItem<>(dummyfile); packageEditor.filesTable.setRoot(root); //Assume a package without is external //TODO: replace with external packages or whatever alternate mechanism in 2.1 packageEditor.btnAddFile.setDisable(pkg.getFiles().length == 0); root.getChildren() .setAll(Stream.of(pkg.getFiles()) .sorted(Comparator.comparing(file -> StringUtils.lowerCase(file.getName()))) //Sort by file name .map(TreeItem<SpdxFile>::new).collect(Collectors.toList())); } catch (InvalidSPDXAnalysisException e) { logger.error("Unable to get files for package " + pkg.getName(), e); } packageEditor.tabFiles.setExpanded(true); }); //Won't assign this event through FXML - don't want to propagate the stage beyond this point. packageEditor.btnOk.setOnMouseClicked(event -> dialogStage.close()); dialogStage.showAndWait(); } catch (IOException ioe) { throw new RuntimeException("Unable to load dialog", ioe); } }
From source file:Main.java
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 500, 200); stage.setScene(scene);//from www. j a v a 2 s . c om Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); //set Stage boundaries to visible bounds of the main screen stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.show(); }
From source file:wpdisplaytest.WPDisplayTest.java
private void moveToSecondaryIfExists(Stage stage) { Screen secondary;//from w ww . j a va 2 s. co m try { secondary = Screen.getScreens().stream().filter(E -> { return !E.equals(Screen.getPrimary()); }).findFirst().get(); Rectangle2D bounds = secondary.getVisualBounds(); stage.setX(bounds.getMinX()); stage.setY(bounds.getMinY()); stage.centerOnScreen(); } catch (NoSuchElementException ex) { //There is no secondary viewport, fail silently } }
From source file:org.jamocha.gui.JamochaGui.java
private void loadState(final Stage primaryStage) { final Preferences userPrefs = Preferences.userNodeForPackage(getClass()); // get window location from user preferences: use x=100, y=100, width=400, height=400 as // default/*from w w w . j a va 2 s . co m*/ primaryStage.setX(userPrefs.getDouble("stage.x", 100)); primaryStage.setY(userPrefs.getDouble("stage.y", 100)); primaryStage.setWidth(userPrefs.getDouble("stage.width", 800)); primaryStage.setHeight(userPrefs.getDouble("stage.height", 600)); }
From source file:org.openbase.display.DisplayView.java
/** * {@inheritDoc}/* w w w. j av a 2 s . co m*/ * * @param visible * @throws org.openbase.jul.exception.CouldNotPerformException */ @Override public Future<Void> setVisible(final Boolean visible) throws CouldNotPerformException { return runTask(() -> { if (visible) { Screen screen = getScreen(); Stage stage = getStage(); stage.setX(screen.getVisualBounds().getMinX()); stage.setY(screen.getVisualBounds().getMinY()); stage.setHeight(screen.getVisualBounds().getHeight()); stage.setWidth(screen.getVisualBounds().getWidth()); getStage().setFullScreen(false); getStage().setAlwaysOnTop(true); getStage().setFullScreen(true); getStage().show(); } else { getStage().hide(); getStage().setFullScreen(false); } return null; }); }
From source file:cz.lbenda.rcp.DialogHelper.java
public void openWindowInCenterOfStage(Stage parentStage, Pane pane, String title) { Stage stage = new Stage(); stage.setTitle(title);//from ww w .j av a2 s. co m stage.setScene(new Scene(pane, pane.getPrefWidth(), pane.getPrefHeight())); stage.getIcons().addAll(parentStage.getIcons()); stage.show(); stage.setX(parentStage.getX() + (parentStage.getWidth() - stage.getWidth()) / 2); stage.setY(parentStage.getY() + (parentStage.getHeight() - stage.getHeight()) / 2); }
From source file:io.bitsquare.app.BitsquareApp.java
private void showFPSWindow() { Label label = new Label(); EventStreams.animationTicks().latestN(100).map(ticks -> { int n = ticks.size() - 1; return n * 1_000_000_000.0 / (ticks.get(n) - ticks.get(0)); }).map(d -> String.format("FPS: %.3f", d)).feedTo(label.textProperty()); Pane root = new StackPane(); root.getChildren().add(label);/* w ww. j ava 2 s. c o m*/ Stage stage = new Stage(); stage.setScene(new Scene(root)); stage.setTitle("FPS"); stage.initModality(Modality.NONE); stage.initStyle(StageStyle.UTILITY); stage.initOwner(scene.getWindow()); stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10); stage.setY(primaryStage.getY()); stage.setWidth(200); stage.setHeight(100); stage.show(); }
From source file:io.bitsquare.app.BitsquareApp.java
private void showDebugWindow() { ViewLoader viewLoader = injector.getInstance(ViewLoader.class); View debugView = viewLoader.load(DebugView.class); Parent parent = (Parent) debugView.getRoot(); Stage stage = new Stage(); stage.setScene(new Scene(parent)); stage.setTitle("Debug window"); stage.initModality(Modality.NONE);//from ww w .ja va2 s. c om stage.initStyle(StageStyle.UTILITY); stage.initOwner(scene.getWindow()); stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10); stage.setY(primaryStage.getY()); stage.show(); }
From source file:investiagenofx2.view.InvestiaGenOFXController.java
private void showInvestmentsSummary(String accountType, Double x, Double y) { try {// ww w . j a v a 2 s . c o m FXMLLoader loader = new FXMLLoader(); loader.setLocation(InvestiaGenOFX.class.getResource("view/investmentsSummary.fxml")); AnchorPane page = (AnchorPane) loader.load(); Stage dialogStage = new Stage(); dialogStage.setTitle("Sommaire des Investissements " + accountType); dialogStage.getIcons().add(new Image("/myIcons/Teddy-Bear-Sick-icon.png")); dialogStage.initModality(Modality.NONE); Scene scene = new Scene(page); dialogStage.initOwner(InvestiaGenOFX.getPrimaryStage()); dialogStage.setX(x); dialogStage.setY(y); dialogStage.setScene(scene); dialogStage.show(); } catch (Exception ex) { Logger.getLogger(InvestiaGenOFXController.class.getName()).log(Level.SEVERE, null, ex); } }