title: Why is my Button Image setGraphic method not being displayed?
body: <p>I have the image files in my bin folder but when I run my program all I have is my button options that are not being replaced with my images. I think it has something to do with the file: in front of the images but I'm not sure. The images are not actually a moving gif (dunno why its called gif).</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.image.Image;
  import javafx.scene.image.ImageView;
  import javafx.scene.layout.HBox;
  import javafx.stage.Stage;
  
  public class Project4 extends Application {
  
      public static void main(String[] args) {
          launch(args);
      }
  
      public void start(Stage primaryStage) throws Exception {
  
          HBox root = new HBox();
  
          Button btnKings;
          Button btnDucks;
          Button btnSharks;
          Button btnBlues;
  
          btnKings = new Button("Kings");
          btnDucks = new Button("Ducks");
          btnSharks = new Button("Sharks");
          btnBlues = new Button("Blues");
  
          Image imgKings = new Image("file:kings.jpg");
          btnKings.setGraphic(new ImageView(imgKings));
  
          Image imgDucks = new Image("file:ducks.gif");
          btnDucks.setGraphic(new ImageView(imgDucks));
  
          Image imgSharks = new Image("file:sharks.gif");
          btnSharks.setGraphic(new ImageView(imgSharks));
  
          Image imgBlues = new Image("file:blues.gif");
          btnBlues.setGraphic(new ImageView(imgBlues));
  
          HandleButtonClick clickEvent = new HandleButtonClick();
          btnKings.setOnAction(clickEvent);
  
          btnDucks.setOnAction(new HandleButtonClick("You clicked the ducKS!"));
          btnKings.setOnAction(new HandleButtonClick("You clicked the Kings"));
          btnSharks.setOnAction(new HandleButtonClick("You clicked the sharks"));
          btnBlues.setOnAction(new HandleButtonClick("You clicked the blues"));
  
          root.getChildren().add(btnKings);
          root.getChildren().add(btnDucks);
          root.getChildren().add(btnSharks);
          root.getChildren().add(btnBlues);
  
          Scene scene = new Scene(root, 960, 130);
          primaryStage.setTitle("HockeyButtons");
          primaryStage.setScene(scene);
          primaryStage.show();
      }
  }
  </code></pre>