List of usage examples for javafx.stage Stage setX
public final void setX(double value)
From source file:org.jevis.jeconfig.JEConfig.java
/** * maximized the given stage//from w w w .j av a2 s . com * * @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:Main.java
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 500, 200); stage.setScene(scene);//from ww w. j a va 2 s . co m 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: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 ww w . j a v a 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:wpdisplaytest.WPDisplayTest.java
private void moveToSecondaryIfExists(Stage stage) { Screen secondary;/* www . j a va2 s . c o 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.openbase.display.DisplayView.java
/** * {@inheritDoc}/*w w w .ja v a 2 s . c om*/ * * @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);//ww w . j a va 2 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);//from w w w.j a va 2s .co 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 w w w. j av a 2s . co m*/ 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 {/* w w w .ja va 2 s . co 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); } }
From source file:acmi.l2.clientmod.l2smr.Controller.java
private void showUmodel(final String obj, final String file) { Platform.runLater(() -> {//from www . j a v a2 s .c om try { FXMLLoader loader = new FXMLLoader(getClass().getResource("smview/smview.fxml")); loader.load(); SMView controller = loader.getController(); controller.setStaticmesh(getStaticMeshDir(), file, obj); Scene scene = new Scene(loader.getRoot()); scene.setOnKeyReleased(controller::onKeyReleased); Stage smStage = new Stage(); smStage.setScene(scene); smStage.setTitle(obj); smStage.show(); smStage.setX(Double.parseDouble(L2smr.getPrefs().get("smview.x", String.valueOf(smStage.getX())))); smStage.setY(Double.parseDouble(L2smr.getPrefs().get("smview.y", String.valueOf(smStage.getY())))); smStage.setWidth(Double .parseDouble(L2smr.getPrefs().get("smview.width", String.valueOf(smStage.getWidth())))); smStage.setHeight(Double .parseDouble(L2smr.getPrefs().get("smview.height", String.valueOf(smStage.getHeight())))); InvalidationListener listener = observable -> { L2smr.getPrefs().put("smview.x", String.valueOf(Math.round(smStage.getX()))); L2smr.getPrefs().put("smview.y", String.valueOf(Math.round(smStage.getY()))); L2smr.getPrefs().put("smview.width", String.valueOf(Math.round(smStage.getWidth()))); L2smr.getPrefs().put("smview.height", String.valueOf(Math.round(smStage.getHeight()))); }; smStage.xProperty().addListener(listener); smStage.yProperty().addListener(listener); smStage.widthProperty().addListener(listener); smStage.heightProperty().addListener(listener); } catch (IOException e) { onException("Couldn't show staticmesh", e); } }); }