1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
   | public void start (Stage stage) throws Exception {
 
		 Scene scene = new Scene(new Group());
	    	final WebView webView = new WebView();
 
	    	final WebView webView1 = new WebView();
	    	WebEngine webengine = webView1.getEngine();
	    	webengine.setJavaScriptEnabled(true);
 
	    	webView.setPrefWidth(taillefenetre);
	    	webView1.setPrefWidth(taillefenetre);
 
	    	Button Coordonnee = new Button ("Coordonnees");
	    	Button Aurevoir = new Button("Trajet du Drone");
	    	Button Modification = new Button("Modification");
	    	DropShadow shadow = new DropShadow();
 
	    	ScrollPane sp = new ScrollPane();
 
	    	final VBox vbox = new VBox();
	    	final HBox hbox = new HBox();
	    	final HBox hbox1 = new HBox();
	    	final HBox hbox2 = new HBox();
 
	    	stage.setWidth(taillefenetre*2+40);
	        stage.setHeight(taillefenetre+50);
 
// Assemblage du tableau
 
	        final TableColumn<Coordonnees, Boolean> visibleColumn = new TableColumn<>("A supprimer");
	        visibleColumn.setMinWidth(taillecolonne/2);
	        visibleColumn.setCellValueFactory(new PropertyValueFactory<>("visible"));
 
	        final TableColumn<Coordonnees, Integer> OrdreCol = new TableColumn<>("Ordre");
	        OrdreCol.setMinWidth(taillecolonne/2);
	        OrdreCol.setCellValueFactory( new PropertyValueFactory<>("Ordre"));
 
	        final TableColumn<Coordonnees, Double> LongeCol = new TableColumn<>("Longitude");
	        LongeCol.setMinWidth(taillecolonne);
	        LongeCol.setCellValueFactory( new PropertyValueFactory<>("Longitude"));
 
	        final TableColumn<Coordonnees, Double> LatCol = new TableColumn<>("Latitude");
	        LatCol.setMinWidth(taillecolonne);
	        LatCol.setCellValueFactory(new PropertyValueFactory<>("Latitude"));
 
	        tableCoor.getColumns().setAll(visibleColumn, OrdreCol, LongeCol, LatCol);
 
	        //////Gestion affichage bouton suppression
	        visibleColumn.setCellFactory(
	                new Callback<TableColumn<Coordonnees, Boolean>, TableCell<Coordonnees, Boolean>>() {
 
	                    @Override
	                    public TableCell<Coordonnees, Boolean> call(TableColumn<Coordonnees, Boolean> p) {
	                        return new ButtonCell();
	                    } });
 
 
 
	        tableCoor.setItems(data);
	    //    tableCoor.getColumns().addAll(OrdreCol, LongeCol,LatCol);   
	        webView.getEngine().load(getClass().getResource("position.html").toExternalForm());
	        final JSObject jsobj = (JSObject) webView.getEngine().executeScript("window"); 
	        jsobj.setMember("java", new Bridge()); 
	        webView1.getEngine().load(getClass().getResource("affiche.html").toExternalForm());
 // Assemblage et affichage
 
 
	        hbox.getChildren().addAll(Coordonnee,Aurevoir,Modification);// Les boutons
 
	        sp.setContent(tableCoor);							// Le tableau
	        sp.setPrefSize(taillefenetre, 150);
	        sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
	        sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
	        sp.setVmax(3);
 
	        hbox1.getChildren().addAll(webView,webView1);		//les deux ecrans map
	        hbox1.setMaxHeight(400);
 
	        hbox2.getChildren().add(sp);						//Le scroll avec le tableau
 
	        vbox.setSpacing(5);
	        vbox.setPadding(new Insets(10, 0, 0, 10));
	        vbox.getChildren().addAll(hbox,hbox1, hbox2);		//empilage des 3 hbox
 
	        ((Group) scene.getRoot()).getChildren().addAll(vbox);
	        stage.setTitle("Test de WebView"); 
	        stage.setScene(scene);
	        stage.show();
 
 
	     // gestion boutons
	        Coordonnee.addEventHandler(MouseEvent.MOUSE_CLICKED,
	                new EventHandler<MouseEvent>() {
	                  @Override
	                  public void handle(MouseEvent e) {
	                	  Coordonnee.setEffect(shadow);
	                	  Modification.setEffect(null);
	                	  Aurevoir.setEffect(null);
	                	  sp.setVisible(true);
 
	                	  	OrdreCol.setVisible(true);
	          	        	LongeCol.setVisible(true);
	          	        	LatCol.setVisible(true);
	                  }
	                });
 
	        Aurevoir.addEventHandler(MouseEvent.MOUSE_CLICKED,
	                new EventHandler<MouseEvent>() {
	                  @Override
	                  public void handle(MouseEvent e) {
	                	  Aurevoir.setEffect(shadow);
	                	  Modification.setEffect(null);
	                	  Coordonnee.setEffect(null);
	                	  webView1.getEngine().executeScript("montranslator(' " + coordoString + " ')");//peut etre a revoir
 
	                  }
	                });
 
 
	        Modification.addEventHandler(MouseEvent.MOUSE_CLICKED,
	                new EventHandler<MouseEvent>() {
	                  @Override
	                  public void handle(MouseEvent e) {
	                	  int asup=2;
	                	  Modification.setEffect(shadow);
	                	  webView.getEngine().executeScript("clearMarkers(' " + asup  + " ')");
 
	                  }
	                });
 
	 } |