title: JavaFX Refreshing To repaint a picture in new Location
body: <p>I'm actually learning JavaFX and trying to make a simple application
  To juste moove a picture of a charactere with arrow.</p>
  
  <p>I did onKeyPressed part wich is working and i'm able to modify the variable locationX and locationY of the object, but the image isn't mooving, is there 
  something like a "repaint()" method to do it simply ? or i have to use Animation ? I'd prefer to not use Animation for the moment .</p>
  
  <p><strong>Fenetre.java</strong></p>
  
  <pre><code>import javafx.application.Application;
  import javafx.event.EventHandler;
  import javafx.scene.Group;
  import javafx.scene.Scene;
  import javafx.scene.image.ImageView;
  import javafx.scene.input.KeyEvent;
  import javafx.scene.layout.HBox;
  import javafx.scene.paint.Color;
  import javafx.stage.Stage;
  
  public class Fenetre extends Application{
  
      public Charac c1;
  
      public void init(){
          c1 = new Charac(110,110);
      }
  
      public void start(Stage stage){
          ImageView ivChar = new ImageView();
          ivChar.setImage(c1.getImg());
          ivChar.relocate((double)c1.getLocationX(),(double)c1.getLocationY());
  
          HBox box = new HBox();
          box.setTranslateX((double)c1.getLocationX());
          box.setTranslateY((double)c1.getLocationY());
          box.getChildren().add(ivChar);
          box.setFocusTraversable(true);
          box.setOnKeyPressed(new EventHandler&lt;KeyEvent&gt;(){
              @Override
              public void handle(KeyEvent e) {
                  switch(e.getCode()){
                      case UP:
                          c1.goUp();
                          break;
                      case DOWN:
                          c1.goDown();
                          break;
                      case LEFT:
                          c1.goLeft();
                          break;
                      case RIGHT:
                          c1.goRight();
                          break;
                  default:
                      break;
                  }   
              }
          });
  
          Group root = new Group();
          root.getChildren().add(box);
          Scene scene = new Scene(root);
          scene.setFill(Color.BLACK);
  
  
          stage.setWidth(600);
          stage.setHeight(600);   
          stage.setTitle("BBMAN");
          stage.setScene(scene);
          stage.show();
  
  
      }
  }
  </code></pre>
  
  <p><strong>Charac.java</strong></p>
  
  <pre><code>import javafx.scene.Parent;
  import javafx.scene.image.Image;
  
  public class Charac extends Parent{
      private int locationX=0;
      private int locationY=0;
      private Image img = new Image("/Images/bbfront.png");
  
      public Charac(int locationX, int locationY){
          this.locationY=locationY;
          this.locationX=locationX;
  
  
      }
  
  
      public void setLocationX(int locationX){
          this.locationX=locationX;
      }
  
      public int getLocationX(){
          return this.locationX;
      }
  
      public int getLocationY(){
          return this.locationY;
      }
      public void setLocationY(int locationY){
          this.locationY=locationY;
      }
  
      public void goRight(){
          this.locationX+=1;
          this.img = new Image("/Images/bbright.png");
      }
  
      public void goLeft() {
          this.locationX-=1;
          this.img = new Image("/Images/bbleft.png");
      }
  
      public void goUp(){
          this.locationY-=1;
          this.img = new Image("/Images/bbup.png");
      }
  
      public void goDown(){
          this.locationY+=1;
          this.img = new Image("/Images/bbfront.png");
  
      }
  
      public Image getImg(){
          return this.img;
      }
  }
  </code></pre>
  
  <p>I don't rly know if i'm posting in the right section, this is my first post .</p>
  
  <p>Thank You All !</p>