title: Check if button graphic is equals an image
body: <p>So i'm making a little application with a button and a Image in there.</p>
  
  <pre><code>btnPlay.setGraphic(new ImageView(imagePlay));
  </code></pre>
  
  <p>Now I've an ActionEvent on it to switch the Image, if the button get clicked (Like the pause Button in Spotify). The problem is, I've no clue and found nothing in the internet how i can handle this with a if - else Statement. And that what I tried is not working.</p>
  
  <pre><code>        btnPlay.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
  
          @Override
          public void handle(ActionEvent event) {
  
              Image imagePause = new Image(path);
  
  
              if (btnPlay.getGraphic().equals(imagePause)) {
                  btnPlay.setGraphic(new ImageView(imagePlay));
              }
  
          }
      });
  </code></pre>
  
  <p>Thanks for every answer. </p>