public PannelloDado(Integer i1, GameManagerAstratta gm) { media = new Media(new File(path).toURI().toString()); this.gm = gm; if (i1 != 0) primo = i1.toString(); else primo = "roll"; setMinWidth(GridPane.USE_COMPUTED_SIZE); setMinHeight(GridPane.USE_COMPUTED_SIZE); setPrefWidth(GridPane.USE_COMPUTED_SIZE); setPrefHeight(GridPane.USE_COMPUTED_SIZE); setMaxWidth(GridPane.USE_COMPUTED_SIZE); setMaxHeight(GridPane.USE_COMPUTED_SIZE); imgDadoUno = new Image("file:dadi/" + primo + ".gif"); imageViewUno = new ImageView(imgDadoUno); ColumnConstraints column1 = new ColumnConstraints(); column1.setPercentWidth(25); getColumnConstraints().addAll(column1); add(imageViewUno, 1, 0); imageViewUno.setTranslateZ(-1); eventoDado = new DadiListener(); imageViewUno.addEventHandler(MouseEvent.MOUSE_RELEASED, eventoDado); }
void setPrimo(int risultato) { imgDadoUno = new Image("file:dadi/" + risultato + ".gif"); imageViewUno = new ImageView(imgDadoUno); imageViewUno.addEventHandler(MouseEvent.MOUSE_RELEASED, eventoDado); imageViewUno.setTranslateZ(-1); this.getChildren().clear(); add(imageViewUno, 1, 0); }