List of usage examples for javafx.scene.shape Circle setCenterX
public final void setCenterX(double value)
From source file:Main.java
static Node dropShadow() { Group g = new Group(); DropShadow ds = new DropShadow(); ds.setOffsetY(3.0f);/* ww w. j a v a 2 s . c o m*/ ds.setColor(Color.color(0.4f, 0.4f, 0.4f)); Text t = new Text(); t.setEffect(ds); t.setCache(true); t.setX(10.0f); t.setY(270.0f); t.setFill(Color.RED); t.setText("JavaFX drop shadow..."); t.setFont(Font.font("null", FontWeight.BOLD, 32)); DropShadow ds1 = new DropShadow(); ds1.setOffsetY(4.0f); Circle c = new Circle(); c.setEffect(ds1); c.setCenterX(50.0f); c.setCenterY(325.0f); c.setRadius(30.0f); c.setFill(Color.ORANGE); c.setCache(true); g.getChildren().add(t); g.getChildren().add(c); return g; }
From source file:Main.java
static Node blendMode() { Rectangle r = new Rectangle(); r.setX(590);//ww w . j a va 2 s . c o m r.setY(50); r.setWidth(50); r.setHeight(50); r.setFill(Color.BLUE); Circle c = new Circle(); c.setFill(Color.rgb(255, 0, 0, 0.5f)); c.setCenterX(590); c.setCenterY(50); c.setRadius(25); Group g = new Group(); g.setBlendMode(BlendMode.MULTIPLY); g.getChildren().add(r); g.getChildren().add(c); return g; }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group root = new Group(); Scene scene = new Scene(root, 550, 250, Color.web("0x0000FF")); Circle circle = new Circle(); circle.setCenterX(100.0f); circle.setCenterY(100.0f);//from ww w . ja va2 s . c o m circle.setRadius(50.0f); root.getChildren().add(circle); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); Group g = new Group(); DropShadow ds1 = new DropShadow(); ds1.setOffsetY(4.0);/* ww w . j a v a2 s . com*/ Circle c = new Circle(); c.setEffect(ds1); c.setCenterX(50.0); c.setCenterY(125.0); c.setRadius(30.0); c.setFill(Color.RED); c.setCache(true); g.getChildren().add(c); root.getChildren().add(g); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
private Circle createCircle(double x, double y, double r, Color color) { Circle circle = new Circle(x, y, r, color); circle.setCursor(Cursor.HAND); circle.setOnMousePressed((t) -> { orgSceneX = t.getSceneX();/*from w w w . j a va 2 s.c om*/ orgSceneY = t.getSceneY(); Circle c = (Circle) (t.getSource()); c.toFront(); }); circle.setOnMouseDragged((t) -> { double offsetX = t.getSceneX() - orgSceneX; double offsetY = t.getSceneY() - orgSceneY; Circle c = (Circle) (t.getSource()); c.setCenterX(c.getCenterX() + offsetX); c.setCenterY(c.getCenterY() + offsetY); orgSceneX = t.getSceneX(); orgSceneY = t.getSceneY(); }); return circle; }
From source file:Pages.LandingPage.java
public void profilePicture(String picture, Stage theStage) { // <editor-fold defaultstate="collapsed" desc="Circle Image"> profile_pic = (new ImageView(new Image(picture))); Rectangle square = new Rectangle(); square.setWidth(150);/*from ww w . j a v a 2s. com*/ square.setHeight(150); profile_pic.setClip(square); Circle clip = new Circle(); clip.setCenterX(75); clip.setCenterY(75); clip.setRadius(75); profile_pic.fitWidthProperty().bind(square.widthProperty()); profile_pic.fitHeightProperty().bind(square.heightProperty()); profile_pic.setClip(clip); profile_pic.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent arg0) { createProfilePicture(theStage); } }); userbox.getChildren().add(profile_pic); // </editor-fold> }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param i/*www. j av a 2s . c o m*/ * @param longitude * @param latitude */ private void afficheHSImage(int i, double longitude, double latitude) { double largeur = imagePanoramique.getFitWidth(); double X = (longitude + 180.0d) * largeur / 360.0d + imagePanoramique.getLayoutX(); double Y = (90.0d - latitude) * largeur / 360.0d; Circle point = new Circle(X, Y, 5); point.setFill(Color.BLUE); point.setStroke(Color.YELLOW); point.setId("img" + i); point.setCursor(Cursor.DEFAULT); pano.getChildren().add(point); Tooltip t = new Tooltip("image n " + (i + 1)); t.setStyle(tooltipStyle); Tooltip.install(point, t); point.setOnDragDetected((MouseEvent me1) -> { point.setFill(Color.YELLOW); point.setStroke(Color.BLUE); dragDrop = true; me1.consume(); }); point.setOnMouseDragged((MouseEvent me1) -> { double XX = me1.getX() - imagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > imagePanoramique.getFitWidth()) { XX = imagePanoramique.getFitWidth(); } point.setCenterX(XX + imagePanoramique.getLayoutX()); double YY = me1.getY(); if (YY < 0) { YY = 0; } if (YY > imagePanoramique.getFitHeight()) { YY = imagePanoramique.getFitHeight(); } point.setCenterY(YY); me1.consume(); }); point.setOnMouseReleased((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); double X1 = me1.getSceneX(); double Y1 = me1.getSceneY(); double mouseX = X1 - imagePanoramique.getLayoutX(); if (mouseX < 0) { mouseX = 0; } if (mouseX > imagePanoramique.getFitWidth()) { mouseX = imagePanoramique.getFitWidth(); } double mouseY = Y1 - pano.getLayoutY() - 109; if (mouseY < 0) { mouseY = 0; } if (mouseY > imagePanoramique.getFitHeight()) { mouseY = imagePanoramique.getFitHeight(); } double longit, lat; double larg = imagePanoramique.getFitWidth(); String chLong, chLat; longit = 360.0f * mouseX / larg - 180; lat = 90.0d - 2.0f * mouseY / larg * 180.0f; panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLatitude(lat); panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLongitude(longit); point.setFill(Color.BLUE); point.setStroke(Color.YELLOW); me1.consume(); }); point.setOnMouseClicked((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#img" + chPoint); if (me1.isControlDown()) { valideHS(); dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); pano.getChildren().remove(pt); for (int o = numeroPoint + 1; o < numImages; o++) { pt = (Node) pano.lookup("#img" + Integer.toString(o)); pt.setId("img" + Integer.toString(o - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); numImages--; panoramiquesProjet[panoActuel].removeHotspotImage(numeroPoint); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); me1.consume(); } else { me1.consume(); } }); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param i//from w ww . j ava2 s . c o m * @param longitude * @param latitude */ private void afficheHS(int i, double longitude, double latitude) { double largeur = imagePanoramique.getFitWidth(); double X = (longitude + 180.0d) * largeur / 360.0d + imagePanoramique.getLayoutX(); double Y = (90.0d - latitude) * largeur / 360.0d; Circle point = new Circle(X, Y, 5); point.setFill(Color.YELLOW); point.setStroke(Color.RED); point.setId("point" + i); point.setCursor(Cursor.DEFAULT); pano.getChildren().add(point); Tooltip t = new Tooltip("point n " + (i + 1)); t.setStyle(tooltipStyle); Tooltip.install(point, t); point.setOnDragDetected((MouseEvent me1) -> { point.setFill(Color.RED); point.setStroke(Color.YELLOW); dragDrop = true; me1.consume(); }); point.setOnMouseDragged((MouseEvent me1) -> { double XX = me1.getX() - imagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > imagePanoramique.getFitWidth()) { XX = imagePanoramique.getFitWidth(); } point.setCenterX(XX + imagePanoramique.getLayoutX()); double YY = me1.getY(); if (YY < 0) { YY = 0; } if (YY > imagePanoramique.getFitHeight()) { YY = imagePanoramique.getFitHeight(); } point.setCenterY(YY); me1.consume(); }); point.setOnMouseReleased((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); double X1 = me1.getSceneX(); double Y1 = me1.getSceneY(); double mouseX = X1 - imagePanoramique.getLayoutX(); if (mouseX < 0) { mouseX = 0; } if (mouseX > imagePanoramique.getFitWidth()) { mouseX = imagePanoramique.getFitWidth(); } double mouseY = Y1 - pano.getLayoutY() - 109; if (mouseY < 0) { mouseY = 0; } if (mouseY > imagePanoramique.getFitHeight()) { mouseY = imagePanoramique.getFitHeight(); } double longit, lat; double larg = imagePanoramique.getFitWidth(); String chLong, chLat; longit = 360.0f * mouseX / larg - 180; lat = 90.0d - 2.0f * mouseY / larg * 180.0f; panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLatitude(lat); panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLongitude(longit); point.setFill(Color.YELLOW); point.setStroke(Color.RED); me1.consume(); }); point.setOnMouseClicked((MouseEvent me1) -> { double mouseX = me1.getSceneX() - imagePanoramique.getLayoutX(); if (mouseX < 0) { mouseX = 0; } if (mouseX > imagePanoramique.getFitWidth()) { mouseX = imagePanoramique.getFitWidth(); } double mouseY = me1.getSceneY() - pano.getLayoutY() - 115; if (mouseY < 0) { mouseY = 0; } if (mouseY > imagePanoramique.getFitHeight()) { mouseY = imagePanoramique.getFitHeight(); } String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#point" + chPoint); if (me1.isControlDown()) { dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); pano.getChildren().remove(pt); for (int o = numeroPoint + 1; o < numPoints; o++) { pt = (Node) pano.lookup("#point" + Integer.toString(o)); pt.setId("point" + Integer.toString(o - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); numPoints--; panoramiquesProjet[panoActuel].removeHotspot(numeroPoint); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); me1.consume(); valideHS(); } else { if (!dragDrop) { if (nombrePanoramiques > 1) { AnchorPane listePanoVig = afficherListePanosVignettes(numeroPoint); int largeurVignettes = 4; if (nombrePanoramiques < 4) { largeurVignettes = nombrePanoramiques; } if (mouseX + largeurVignettes * 130 > pano.getWidth()) { listePanoVig.setLayoutX(pano.getWidth() - largeurVignettes * 130); } else { listePanoVig.setLayoutX(mouseX); } listePanoVig.setLayoutY(mouseY); pano.getChildren().add(listePanoVig); } } else { dragDrop = false; } valideHS(); me1.consume(); } }); }
From source file:editeurpanovisu.EditeurPanovisu.java
private void panoMouseClic(double X, double Y) { if (nombrePanoramiques > 1) { valideHS();/*from w w w . j a va 2 s . c o m*/ dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); double mouseX = X; double mouseY = Y - pano.getLayoutY() - 109; if (X > 0 && X < imagePanoramique.getFitWidth()) { double longitude, latitude; double largeur = imagePanoramique.getFitWidth(); String chLong, chLat; longitude = 360.0f * mouseX / largeur - 180; latitude = 90.0d - 2.0f * mouseY / largeur * 180.0f; Circle point = new Circle(mouseX + imagePanoramique.getLayoutX(), mouseY, 5); point.setFill(Color.YELLOW); point.setStroke(Color.RED); point.setId("point" + numPoints); point.setCursor(Cursor.DEFAULT); pano.getChildren().add(point); Tooltip t = new Tooltip("point n" + (numPoints + 1)); t.setStyle(tooltipStyle); Tooltip.install(point, t); HotSpot HS = new HotSpot(); HS.setLongitude(longitude); HS.setLatitude(latitude); panoramiquesProjet[panoActuel].addHotspot(HS); retireAffichageHotSpots(); Pane affHS1 = affichageHS(listePano(panoActuel), panoActuel); affHS1.setId("labels"); outils.getChildren().add(affHS1); numPoints++; if (nombrePanoramiques > 1) { AnchorPane listePanoVig = afficherListePanosVignettes( panoramiquesProjet[panoActuel].getNombreHotspots() - 1); int largeurVignettes = 4; if (nombrePanoramiques < 4) { largeurVignettes = nombrePanoramiques; } if (mouseX + largeurVignettes * 130 > pano.getWidth()) { listePanoVig.setLayoutX(pano.getWidth() - largeurVignettes * 130); } else { listePanoVig.setLayoutX(mouseX); } listePanoVig.setLayoutY(mouseY); pano.getChildren().add(listePanoVig); valideHS(); } point.setOnDragDetected((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#point" + chPoint); point.setFill(Color.RED); point.setStroke(Color.YELLOW); dragDrop = true; me1.consume(); }); point.setOnMouseDragged((MouseEvent me1) -> { double XX = me1.getX() - imagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > imagePanoramique.getFitWidth()) { XX = imagePanoramique.getFitWidth(); } point.setCenterX(XX + imagePanoramique.getLayoutX()); double YY = me1.getY(); if (YY < 0) { YY = 0; } if (YY > imagePanoramique.getFitHeight()) { YY = imagePanoramique.getFitHeight(); } point.setCenterY(YY); me1.consume(); }); point.setOnMouseReleased((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); double X1 = me1.getSceneX(); double Y1 = me1.getSceneY(); double mouseX1 = X1 - imagePanoramique.getLayoutX(); if (mouseX1 < 0) { mouseX1 = 0; } if (mouseX1 > imagePanoramique.getFitWidth()) { mouseX1 = imagePanoramique.getFitWidth(); } double mouseY1 = Y1 - pano.getLayoutY() - 109; if (mouseY1 < 0) { mouseY1 = 0; } if (mouseY1 > imagePanoramique.getFitHeight()) { mouseY1 = imagePanoramique.getFitHeight(); } double longit, lat; double larg = imagePanoramique.getFitWidth(); longit = 360.0f * mouseX1 / larg - 180; lat = 90.0d - 2.0f * mouseY1 / larg * 180.0f; panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLatitude(lat); panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLongitude(longit); point.setFill(Color.YELLOW); point.setStroke(Color.RED); me1.consume(); }); point.setOnMouseClicked((MouseEvent me1) -> { if (me1.isControlDown()) { dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#point" + chPoint); pano.getChildren().remove(pt); for (int o = numeroPoint + 1; o < numPoints; o++) { pt = (Node) pano.lookup("#point" + Integer.toString(o)); pt.setId("point" + Integer.toString(o - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); numPoints--; panoramiquesProjet[panoActuel].removeHotspot(numeroPoint); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); valideHS(); me1.consume(); } else { if (!dragDrop) { String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); if (nombrePanoramiques > 1) { AnchorPane listePanoVig = afficherListePanosVignettes(numeroPoint); int largeurVignettes = 4; if (nombrePanoramiques < 4) { largeurVignettes = nombrePanoramiques; } if (mouseX + largeurVignettes * 130 > pano.getWidth()) { listePanoVig.setLayoutX(pano.getWidth() - largeurVignettes * 130); } else { listePanoVig.setLayoutX(mouseX); } listePanoVig.setLayoutY(mouseY); pano.getChildren().add(listePanoVig); } } else { dragDrop = false; } valideHS(); me1.consume(); } }); } } }
From source file:editeurpanovisu.EditeurPanovisu.java
private void panoAjouteImage(double X, double Y) { if (X > 0 && X < imagePanoramique.getFitWidth()) { valideHS();// w w w .j a v a2s .c o m dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); double mouseX = X; double mouseY = Y - pano.getLayoutY() - 115; double longitude, latitude; double largeur = imagePanoramique.getFitWidth(); String chLong, chLat; longitude = 360.0f * mouseX / largeur - 180; latitude = 90.0d - 2.0f * mouseY / largeur * 180.0f; Circle point = new Circle(mouseX, mouseY, 5); point.setFill(Color.BLUE); point.setStroke(Color.YELLOW); point.setId("img" + numImages); point.setCursor(Cursor.DEFAULT); pano.getChildren().add(point); Tooltip t = new Tooltip("image n " + (numImages + 1)); t.setStyle(tooltipStyle); Tooltip.install(point, t); // File repert; if (repertHSImages.equals("")) { repert = new File(currentDir + File.separator); } else { repert = new File(repertHSImages); } FileChooser fileChooser = new FileChooser(); FileChooser.ExtensionFilter extFilterImages = new FileChooser.ExtensionFilter( "Fichiers Images (jpg, bmp, png)", "*.jpg", "*.bmp", "*.png"); fileChooser.setInitialDirectory(repert); fileChooser.getExtensionFilters().addAll(extFilterImages); File fichierImage = fileChooser.showOpenDialog(null); if (fichierImage != null) { repertHSImages = fichierImage.getParent(); numImages++; HotspotImage HS = new HotspotImage(); HS.setLongitude(longitude); HS.setLatitude(latitude); HS.setUrlImage(fichierImage.getAbsolutePath()); HS.setLienImg(fichierImage.getName()); HS.setInfo(fichierImage.getName().split("\\.")[0]); File repertImage = new File(repertTemp + File.separator + "images"); if (!repertImage.exists()) { repertImage.mkdirs(); } try { copieFichierRepertoire(fichierImage.getAbsolutePath(), repertImage.getAbsolutePath()); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } panoramiquesProjet[panoActuel].addHotspotImage(HS); retireAffichageHotSpots(); Pane affHS1 = affichageHS(listePano(panoActuel), panoActuel); affHS1.setId("labels"); outils.getChildren().add(affHS1); } else { String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); Node pt = (Node) pano.lookup("#img" + chPoint); pano.getChildren().remove(pt); } valideHS(); point.setOnDragDetected((MouseEvent me1) -> { point.setFill(Color.YELLOW); point.setStroke(Color.BLUE); dragDrop = true; me1.consume(); }); point.setOnMouseDragged((MouseEvent me1) -> { double XX = me1.getX() - imagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > imagePanoramique.getFitWidth()) { XX = imagePanoramique.getFitWidth(); } point.setCenterX(XX + imagePanoramique.getLayoutX()); double YY = me1.getY(); if (YY < 0) { YY = 0; } if (YY > imagePanoramique.getFitHeight()) { YY = imagePanoramique.getFitHeight(); } point.setCenterY(YY); me1.consume(); }); point.setOnMouseReleased((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); double X1 = me1.getSceneX(); double Y1 = me1.getSceneY(); double mouseX1 = X1 - imagePanoramique.getLayoutX(); if (mouseX1 < 0) { mouseX1 = 0; } if (mouseX1 > imagePanoramique.getFitWidth()) { mouseX1 = imagePanoramique.getFitWidth(); } double mouseY1 = Y1 - pano.getLayoutY() - 109; if (mouseY1 < 0) { mouseY1 = 0; } if (mouseY1 > imagePanoramique.getFitHeight()) { mouseY1 = imagePanoramique.getFitHeight(); } double longit, lat; double larg = imagePanoramique.getFitWidth(); longit = 360.0f * mouseX1 / larg - 180; lat = 90.0d - 2.0f * mouseY1 / larg * 180.0f; panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLatitude(lat); panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLongitude(longit); point.setFill(Color.BLUE); point.setStroke(Color.YELLOW); me1.consume(); }); point.setOnMouseClicked((MouseEvent me1) -> { if (me1.isControlDown()) { dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#img" + chPoint); pano.getChildren().remove(pt); for (int o = numeroPoint + 1; o < numImages; o++) { pt = (Node) pano.lookup("#img" + Integer.toString(o)); pt.setId("img" + Integer.toString(o - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); numImages--; panoramiquesProjet[panoActuel].removeHotspotImage(numeroPoint); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); } valideHS(); me1.consume(); }); } }