List of usage examples for javafx.geometry Rectangle2D getHeight
public double getHeight()
From source file:org.martus.client.swingui.PureFxMainWindow.java
public static double getNonFullScreenHeight(double potentialHeight) { Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds(); final double screenHeight = screenBounds.getHeight(); if (potentialHeight < screenHeight) return potentialHeight; //NOTE mac allows full screen of app and will save full screen height. However app cannot be restored in full screen height. final double maxHeight = screenHeight - screenBounds.getMinY(); return maxHeight; }
From source file:org.dataconservancy.packaging.gui.App.java
public void start(Stage stage) throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath*:org/dataconservancy/config/applicationContext.xml", "classpath*:org/dataconservancy/packaging/tool/ser/config/applicationContext.xml", "classpath*:applicationContext.xml"); // min supported size is 800x600 stage.setMinWidth(800);// www .j a v a2s .co m stage.setMinHeight(550); Factory factory = (Factory) context.getBean("factory"); factory.setStage(stage); Font.loadFont(App.class.getResource("/fonts/OpenSans-Regular.ttf").toExternalForm(), 14); Font.loadFont(App.class.getResource("/fonts/OpenSans-Italic.ttf").toExternalForm(), 14); Font.loadFont(App.class.getResource("/fonts/OpenSans-Bold.ttf").toExternalForm(), 14); Configuration config = factory.getConfiguration(); CmdLineParser parser = new CmdLineParser(config); try { List<String> raw = getParameters().getRaw(); parser.parseArgument(raw.toArray(new String[raw.size()])); } catch (CmdLineException e) { System.out.println(e.getMessage()); log.error(e.getMessage()); Platform.exit(); return; } Controller controller = factory.getController(); controller.setApplicationHostServices(getHostServices()); controller.startApp(); // Default size to 800x800, but shrink if screen is too small double sceneHeight = 800; Rectangle2D screen = Screen.getPrimary().getVisualBounds(); if (screen.getHeight() < 800) { sceneHeight = screen.getHeight() - 50; if (sceneHeight < 550) sceneHeight = 550; } Scene scene = new Scene(controller.asParent(), 800, sceneHeight); scene.getStylesheets().add("/css/app.css"); stage.getIcons().add(new Image("/images/DCPackageTool-icon.png")); stage.setTitle("DC Package Tool"); stage.setScene(scene); stage.show(); }
From source file:de.unibw.inf2.fishification.Launch.java
@Override public void start(Stage primaryStage) { m_log.info("Fishification launched."); // Store JavaFx stage for thread-safe access StageSingleton.injectStage(primaryStage); boolean fullScreenMode = true; int serverPort = 8088; String serverEndpoint = "fishworld"; try {/*from w w w.j av a2s . co m*/ // Load configuration PropertiesConfiguration config = new PropertiesConfiguration("app.properties"); // Assign properties m_serverMode = config.getBoolean("fishification.server.active"); fullScreenMode = config.getBoolean("fishification.fullscreen"); serverPort = config.getInt("fishification.server.port"); serverEndpoint = config.getString("fishification.server.endpoint"); } catch (ConfigurationException e) { m_log.warn(MarkerManager.getMarker("EXCEPTION"), "Error reading configuration.", e); } // Init Server ? if (!m_serverMode) { m_log.info(String.format("Starting in client mode with fullscreen: '%b'", fullScreenMode)); // Create World m_world = new FishWorld(); // Init World Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds(); m_world.initialize(screenBounds.getWidth(), screenBounds.getHeight()); // Let's go m_world.launch(); } else { // Launch Server m_log.info(String.format("Starting server with port: '%d' endpoint: '%s' fullscreen: '%b'", serverPort, serverEndpoint, fullScreenMode)); try { // Set up server FishificationServer.launch(serverPort, serverEndpoint); } catch (Exception e) { m_log.error(MarkerManager.getMarker("EXCEPTION"), "Error launching the server. Exit application.", e); Platform.exit(); } } // Focus window primaryStage.show(); // Full Screen mode if (fullScreenMode) { primaryStage.setFullScreen(true); } }
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);/* www . j a v a2s.com*/ 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:de.ks.text.AsciiDocEditor.java
@FXML void showPreviewPopup() { if (previewPopupStage == null) { String title = Localized.get("adoc.preview"); previewPopupStage = new Stage(); previewPopupStage.setTitle(title); Scene scene = new Scene(new StackPane(popupPreviewNode)); scene.setOnKeyReleased(e -> { if (e.getCode() == KeyCode.ESCAPE) { previewPopupStage.close(); }/*from w ww .j a v a 2s . com*/ }); previewPopupStage.setScene(scene); Rectangle2D bounds = new ScreenResolver().getScreenToShow().getBounds(); previewPopupStage.setX(bounds.getMinX()); previewPopupStage.setY(bounds.getMinY()); previewPopupStage.setWidth(bounds.getWidth()); previewPopupStage.setHeight(bounds.getHeight()); previewPopupStage.initModality(Modality.NONE); previewPopupStage.setOnShowing(e -> { popupPreview.showDirect(getText()); }); previewPopupStage.setOnCloseRequest(e -> this.previewPopupStage = null); previewPopupStage.show(); } }
From source file:jp.co.heppokoact.autocapture.FXMLDocumentController.java
/** * ???????????/* w ww . j a va 2s . co m*/ * ???????? * ???ESC???????? * * @return ??????? * @throws IOException ????? */ private Stage createTransparentStage() throws IOException { // ?????????? Stage transparentStage = new Stage(StageStyle.TRANSPARENT); transparentStage.initOwner(anchorPane.getScene().getWindow()); transparentStage.initModality(Modality.APPLICATION_MODAL); transparentStage.setResizable(false); Rectangle2D rect = Screen.getPrimary().getVisualBounds(); transparentStage.setWidth(rect.getWidth()); transparentStage.setHeight(rect.getHeight()); // ??? java.awt.Rectangle awtRect = new java.awt.Rectangle((int) rect.getWidth(), (int) rect.getHeight()); BufferedImage captureImage = robot.createScreenCapture(awtRect); // ?????? ByteArrayInputStream in = ImageUtil.convToInputStream(captureImage); BackgroundImage bgImage = new BackgroundImage(new Image(in), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT); Pane pane = new Pane(); pane.setBackground(new Background(bgImage)); pane.setStyle("-fx-border-color: rgba(255, 255, 0, 0.5); -fx-border-style: solid; -fx-border-width: 15;"); // ???ESC????? Scene scene = new Scene(pane); transparentStage.setScene(scene); scene.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.ESCAPE) { transparentStage.close(); } }); return transparentStage; }
From source file:com.deicos.lince.Initializer.java
@Override public void start(Stage stage) throws Exception { /*AppPreloader preloader = new AppPreloader(); preloader.start(stage);*/// ww w . ja va 2 s . c o m notifyPreloader(new Preloader.StateChangeNotification(Preloader.StateChangeNotification.Type.BEFORE_START)); stage.setTitle(windowTitle); //stage.setScene(new Scene(mainLayout)); Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds(); Browser browser = new Browser(BrowserType.HEAVYWEIGHT); BrowserView view = new BrowserView(browser); //String url = getClass().getClassLoader().getResource("app-lince.html").toString(); String url = getServerURL(); browser.loadURL(url); String remoteDebuggingURL = browser.getRemoteDebuggingURL(); logger.info("=============================================================================="); logger.info(" Remote debug :" + remoteDebuggingURL); logger.info(" Remote uri :" + url); logger.info("=============================================================================="); Scene scene = new Scene(new BorderPane(view), screenBounds.getWidth() - 20, screenBounds.getHeight() - 40); stage.setScene(scene); stage.setResizable(true); stage.centerOnScreen(); stage.show(); stage.setOnCloseRequest(this); }
From source file:Main.java
@Override public void start(Stage stage) { BorderPane root = new BorderPane(); Pane parentContainer = new Pane(); parentContainer.setPrefSize(500, 500); parentContainer.setPickOnBounds(false); //Pane parent = new Pane(); Group parent = new Group(); boundsLayoutNode = parent;/*from w w w .j a va2 s . co m*/ //parent.setPrefSize(300, 200); parent.setLayoutX(200); parent.setLayoutY(200); parent.setStyle("-fx-background-color:white;"); parent.getChildren().addAll(new Group(localXAxisGroup, localYAxisGroup), new Group(parentXAxisGroup, parentYAxisGroup), new Group(parentBoundsRect, PARENT_BOUNDS_PATH_CIRCLE), new Group(localBoundsRect, LOCAL_BOUNDS_PATH_CIRCLE), new Group(layoutBoundsRect, LAYOUT_BOUNDS_PATH_CIRCLE), new Group(mainRect)); parentContainer.getChildren().addAll(parent); VBox transformsControls = getTransformationControls(); VBox resultsControls = getResultsControls(); BorderPane nestedPane = new BorderPane(); nestedPane.setCenter(parentContainer); nestedPane.setBottom(resultsControls); //nestedPane.setTop(printDataTextArea); //printDataTextArea.setPrefColumnCount(40); //printDataTextArea.setPrefRowCount(3); root.setCenter(nestedPane); root.setRight(transformsControls); //root.setBottom(resultsControls); //root.setCenter(parentContainer); // Attach event handlers attachEventHandlers(); Scene scene = new Scene(root); //, 600, 400); stage.setScene(scene); stage.setTitle("Bounds of a Node"); Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds(); stage.setX(visualBounds.getMinX()); stage.setY(visualBounds.getMinY()); stage.setWidth(visualBounds.getWidth()); stage.setHeight(visualBounds.getHeight()); stage.show(); // Make sure everything is in sync relayout(); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param i/*from w w w. j a v a 2 s .c om*/ * @param longitude * @param latitude */ private static void afficheHSHTML(int i, double longitude, double latitude) { double largeur = ivImagePanoramique.getFitWidth(); double X = (longitude + 180.0d) * largeur / 360.0d + ivImagePanoramique.getLayoutX(); double Y = (90.0d - latitude) * largeur / 360.0d; Circle circPoint = new Circle(X, Y, 5); circPoint.setFill(Color.DARKGREEN); circPoint.setStroke(Color.YELLOWGREEN); circPoint.setId("html" + i); circPoint.setCursor(Cursor.DEFAULT); panePanoramique.getChildren().add(circPoint); Tooltip tltpHSImage = new Tooltip("HTML #" + (i + 1)); tltpHSImage.setStyle(getStrTooltipStyle()); Tooltip.install(circPoint, tltpHSImage); circPoint.setOnDragDetected((mouseEvent1) -> { circPoint.setFill(Color.YELLOWGREEN); circPoint.setStroke(Color.DARKGREEN); bDragDrop = true; mouseEvent1.consume(); }); circPoint.setOnMouseDragged((mouseEvent1) -> { double XX = mouseEvent1.getX() - ivImagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > ivImagePanoramique.getFitWidth()) { XX = ivImagePanoramique.getFitWidth(); } circPoint.setCenterX(XX + ivImagePanoramique.getLayoutX()); double YY = mouseEvent1.getY(); if (YY < 0) { YY = 0; } if (YY > ivImagePanoramique.getFitHeight()) { YY = ivImagePanoramique.getFitHeight(); } circPoint.setCenterY(YY); afficheLoupe(XX, YY); mouseEvent1.consume(); }); circPoint.setOnMouseReleased((mouseEvent1) -> { String strPoint = circPoint.getId(); strPoint = strPoint.substring(4, strPoint.length()); int iNumeroPoint = Integer.parseInt(strPoint); double X1 = mouseEvent1.getSceneX(); double Y1 = mouseEvent1.getSceneY(); double mouseX = X1 - ivImagePanoramique.getLayoutX(); if (mouseX < 0) { mouseX = 0; } if (mouseX > ivImagePanoramique.getFitWidth()) { mouseX = ivImagePanoramique.getFitWidth(); } double mouseY = Y1 - panePanoramique.getLayoutY() - 130 - getiDecalageMac(); if (mouseY < 0) { mouseY = 0; } if (mouseY > ivImagePanoramique.getFitHeight()) { mouseY = ivImagePanoramique.getFitHeight(); } double longit, lat; double larg = ivImagePanoramique.getFitWidth(); String strLong, strLat; longit = 360.0f * mouseX / larg - 180; lat = 90.0d - 2.0f * mouseY / larg * 180.0f; getPanoramiquesProjet()[getiPanoActuel()].getHotspotHTML(iNumeroPoint).setLatitude(lat); getPanoramiquesProjet()[getiPanoActuel()].getHotspotHTML(iNumeroPoint).setLongitude(longit); circPoint.setFill(Color.DARKGREEN); circPoint.setStroke(Color.YELLOWGREEN); mouseEvent1.consume(); }); circPoint.setOnMouseClicked((mouseEvent1) -> { String strPoint = circPoint.getId(); strPoint = strPoint.substring(4, strPoint.length()); int iNum = Integer.parseInt(strPoint); Node nodePointImage; nodePointImage = (Node) panePanoramique.lookup("#html" + strPoint); if (mouseEvent1.isControlDown()) { valideHS(); setbDejaSauve(false); getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *"); panePanoramique.getChildren().remove(nodePointImage); for (int io = iNum + 1; io < getiNumImages(); io++) { nodePointImage = (Node) panePanoramique.lookup("#html" + Integer.toString(io)); nodePointImage.setId("img" + Integer.toString(io - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); setiNumHTML(getiNumHTML() - 1); getPanoramiquesProjet()[getiPanoActuel()].removeHotspotHTML(iNum); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); mouseEvent1.consume(); } else { if (!bDragDrop) { EditeurHTML editHTML = new EditeurHTML(); HotspotHTML HS = getPanoramiquesProjet()[getiPanoActuel()].getHotspotHTML(iNum); editHTML.setHsHTML(HS); Rectangle2D tailleEcran = Screen.getPrimary().getBounds(); int iHauteur = (int) tailleEcran.getHeight() - 100; int iLargeur = (int) tailleEcran.getWidth() - 100; editHTML.affiche(iLargeur, iHauteur); editHTML.addPropertyChangeListener("bValide", (ev) -> { if (ev.getNewValue().toString().equals("true")) { getPanoramiquesProjet()[getiPanoActuel()].setHotspotHTML(editHTML.getHsHTML(), iNum); dejaCharge = false; retireAffichageHotSpots(); Pane affHS1 = paneAffichageHS(strListePano(), getiPanoActuel()); affHS1.setId("labels"); vbVisuHotspots.getChildren().add(affHS1); } }); } else { bDragDrop = false; } mouseEvent1.consume(); } }); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param X//from w ww . ja v a2 s . c om * @param Y */ private static void panoAjouteHTML(double X, double Y) { if (X > 0 && X < ivImagePanoramique.getFitWidth()) { valideHS(); setbDejaSauve(false); getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *"); double mouseX = X; double mouseY = Y - panePanoramique.getLayoutY() - 130 - getiDecalageMac(); double longitude, latitude; double largeur = ivImagePanoramique.getFitWidth(); longitude = 360.0f * mouseX / largeur - 180; latitude = 90.0d - 2.0f * mouseY / largeur * 180.0f; Circle circPoint = new Circle(mouseX + ivImagePanoramique.getLayoutX(), mouseY, 5); circPoint.setFill(Color.DARKGREEN); circPoint.setStroke(Color.YELLOWGREEN); circPoint.setId("html" + getiNumHTML()); circPoint.setCursor(Cursor.DEFAULT); panePanoramique.getChildren().add(circPoint); Tooltip tltpImage = new Tooltip("HTML n " + (getiNumHTML() + 1)); tltpImage.setStyle(getStrTooltipStyle()); Tooltip.install(circPoint, tltpImage); EditeurHTML editHTML = new EditeurHTML(); HotspotHTML HS = new HotspotHTML(); editHTML.setHsHTML(HS); HS.setLongitude(longitude); HS.setLatitude(latitude); Rectangle2D tailleEcran = Screen.getPrimary().getBounds(); int iHauteur = (int) tailleEcran.getHeight() - 100; int iLargeur = (int) tailleEcran.getWidth() - 100; editHTML.affiche(iLargeur, iHauteur); editHTML.addPropertyChangeListener("bValide", (e) -> { if (e.getNewValue().toString().equals("true")) { setiNumHTML(getiNumHTML() + 1); getPanoramiquesProjet()[getiPanoActuel()].addHotspotHTML(editHTML.getHsHTML()); retireAffichageHotSpots(); dejaCharge = false; Pane affHS1 = paneAffichageHS(strListePano(), getiPanoActuel()); affHS1.setId("labels"); vbVisuHotspots.getChildren().add(affHS1); spPanneauOutils.setVvalue(spPanneauOutils.getVvalue() + 145); } }); editHTML.addPropertyChangeListener("bAnnule", (e) -> { if (e.getNewValue().toString().equals("true")) { String strPoint = circPoint.getId(); strPoint = strPoint.substring(4, strPoint.length()); Node nodeImage = (Node) panePanoramique.lookup("#html" + strPoint); panePanoramique.getChildren().remove(nodeImage); } }); valideHS(); circPoint.setOnDragDetected((mouseEvent1) -> { circPoint.setFill(Color.YELLOWGREEN); circPoint.setStroke(Color.DARKGREEN); bDragDrop = true; mouseEvent1.consume(); }); circPoint.setOnMouseDragged((mouseEvent1) -> { double XX = mouseEvent1.getX() - ivImagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > ivImagePanoramique.getFitWidth()) { XX = ivImagePanoramique.getFitWidth(); } circPoint.setCenterX(XX + ivImagePanoramique.getLayoutX()); double YY = mouseEvent1.getY(); if (YY < 0) { YY = 0; } if (YY > ivImagePanoramique.getFitHeight()) { YY = ivImagePanoramique.getFitHeight(); } circPoint.setCenterY(YY); afficheLoupe(XX, YY); mouseEvent1.consume(); }); circPoint.setOnMouseReleased((mouseEvent1) -> { setbDejaSauve(false); getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *"); String strPoint = circPoint.getId(); strPoint = strPoint.substring(4, strPoint.length()); int iNumeroPoint = Integer.parseInt(strPoint); double X1 = mouseEvent1.getSceneX(); double Y1 = mouseEvent1.getSceneY(); double mouseX1 = X1 - ivImagePanoramique.getLayoutX(); if (mouseX1 < 0) { mouseX1 = 0; } if (mouseX1 > ivImagePanoramique.getFitWidth()) { mouseX1 = ivImagePanoramique.getFitWidth(); } double mouseY1 = Y1 - panePanoramique.getLayoutY() - 130 - getiDecalageMac(); if (mouseY1 < 0) { mouseY1 = 0; } if (mouseY1 > ivImagePanoramique.getFitHeight()) { mouseY1 = ivImagePanoramique.getFitHeight(); } double longit, lat; double larg = ivImagePanoramique.getFitWidth(); longit = 360.0f * mouseX1 / larg - 180; lat = 90.0d - 2.0f * mouseY1 / larg * 180.0f; getPanoramiquesProjet()[getiPanoActuel()].getHotspotHTML(iNumeroPoint).setLatitude(lat); getPanoramiquesProjet()[getiPanoActuel()].getHotspotHTML(iNumeroPoint).setLongitude(longit); circPoint.setFill(Color.DARKGREEN); circPoint.setStroke(Color.YELLOWGREEN); mouseEvent1.consume(); }); circPoint.setOnMouseClicked((mouseEvent1) -> { String strPoint = circPoint.getId(); strPoint = strPoint.substring(4, strPoint.length()); int iNum = Integer.parseInt(strPoint); if (mouseEvent1.isControlDown()) { setbDejaSauve(false); getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *"); Node nodeImage; nodeImage = (Node) panePanoramique.lookup("#html" + strPoint); panePanoramique.getChildren().remove(nodeImage); for (int io = iNum + 1; io < getiNumHTML(); io++) { nodeImage = (Node) panePanoramique.lookup("#html" + Integer.toString(io)); nodeImage.setId("html" + Integer.toString(io - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); setiNumHTML(getiNumHTML() - 1); getPanoramiquesProjet()[getiPanoActuel()].removeHotspotHTML(iNum); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); } else { if (!bDragDrop) { setbDejaSauve(false); getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *"); EditeurHTML editHTML1 = new EditeurHTML(); HotspotHTML HS1 = getPanoramiquesProjet()[getiPanoActuel()].getHotspotHTML(iNum); editHTML1.setHsHTML(HS1); Rectangle2D tailleEcran1 = Screen.getPrimary().getBounds(); int iHauteur1 = (int) tailleEcran1.getHeight() - 100; int iLargeur1 = (int) tailleEcran1.getWidth() - 100; editHTML1.affiche(iLargeur1, iHauteur1); editHTML1.addPropertyChangeListener("bValide", (ev) -> { if (ev.getNewValue().toString().equals("true")) { getPanoramiquesProjet()[getiPanoActuel()].setHotspotHTML(editHTML1.getHsHTML(), iNum); retireAffichageHotSpots(); dejaCharge = false; Pane affHS1 = paneAffichageHS(strListePano(), getiPanoActuel()); affHS1.setId("labels"); vbVisuHotspots.getChildren().add(affHS1); apVisuHS.setPrefHeight(affHS1.getPrefHeight()); } }); } else { bDragDrop = false; } mouseEvent1.consume(); } valideHS(); mouseEvent1.consume(); }); } }