title: JavaFX change the image in an imageView
body: <p>Basically I have a method to load an Image from database into an imageView and a second method to change the image I'm sucessfully running both methods without getting an exception but after the setImage in changeImage() method what do I need to update and how (scene,stage) is it possible at all. I know that there is no method like repaint() in swing in javafx, so how do I approach this ?        </p>
  
  <pre><code>public class MainMenuController implements Initializable {
  
      /**
       * Initializes the controller class.
       */
      @Override
      public void initialize(URL url, ResourceBundle rb) {
          // TODO
      }
  
      private AnchorPane stck1;
  
   @FXML
      private AnchorPane openSecondWindow(ActionEvent event) throws Exception {
          GUIController ctrl = new GUIController();
          Stage stage = new Stage();
         setStck1((AnchorPane) FXMLLoader.load(InteractiveFictionGame2.class.getResource("GUI.fxml")));
          ImageView img_1 = new ImageView(ctrl.loadImg().getImage());
          img_1.setPreserveRatio(true);
          img_1.setSmooth(true);
          img_1.setCache(true);
          getStck1().getChildren().add(img_1);
          Scene scene = new Scene(getStck1());
          stage.setTitle("Interactive Fiction Game");
          stage.setScene(scene);
           stage.setFullScreen(true);
         // stage.sizeToScene();
          stage.show();
         return getStck1();
      }
  
  
  
  
  
  
  public class GUIController implements Initializable {
  
      @FXML
      private TabPane tb1;
  
      /**
       * Initializes the controller class.
       *
       * @param url
       */
      @Override
      public void initialize(URL url, ResourceBundle rb) {
          // TODO
      }
      @FXML
      private ImageView img_1;
  
  
  
  
  
   public ImageView loadImg() {
  
          try {
  
              con = DriverManager.getConnection(host, unm, pswrd);
              stmnt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
              rs = stmnt.executeQuery(SQL);
              rs.next();
              fis = rs.getBinaryStream(4);
              imgt = javax.imageio.ImageIO.read(fis);
              Image newImg = SwingFXUtils.toFXImage(imgt, null);
              img_1 = new ImageView();
              img_1.setImage(newImg);
              rs.close();
              stmnt.close();
  
              con.close();
          } catch (Exception e) {
              System.out.println("Not working");
          }
          return img_1;
      }
  
  
  public void changeImage() {
  ..
              fis = rs.getBinaryStream(1);
              imgt = javax.imageio.ImageIO.read(fis);
              Image newImg = SwingFXUtils.toFXImage(imgt, null);
              img_1.setImage(newImg);
  ...
   } catch (Exception e) {
              System.out.println("Not working");
          }
          return img_1;
      }
  </code></pre>