1

I'm vey new to both CSS and JavaFX but as far as I'm concerned this should work.

In my Java file i have the following code for the HBox method:

    public HBox otherBtns(){
    HBox hbox1 = new HBox();
    hbox1.setPadding(new Insets(10, 12, 15, 12));
    hbox1.setSpacing(12);
    hbox1.setId("hbox1");
    hbox1.getChildren().addAll(btnEmbark, btnDisEmbark);
    return hbox1;
}

In my css file i use hbox1

#hbox1{
-fx-background-image: url("http://www.vectorgraphit.com/wp-content/uploads/2014/04/trianglify-background-6.jpg");

}

The rest of my css works fine except i can't seem to attach this background to the HBox.

I'm getting the following error:

 com.sun.javafx.css.converters.URLConverter resolve
WARNING: unknown protocol: c
Johan Rovala
  • 174
  • 1
  • 2
  • 14
  • possible duplicate of [JavaFX How to set scene background image](http://stackoverflow.com/questions/9738146/javafx-how-to-set-scene-background-image) – Roland Feb 04 '15 at 16:34
  • Check out the duplicate I linked to. Besides, I got another problem, not the "unknown protocol" error. But using the google image like in the link to the duplicate worked without problems. So my guess is it's a server problem. Which Java version are you using? Besides, why don't you store the image with your JavaFX application? – Roland Feb 04 '15 at 16:36
  • Hi, seems like I've tried everything. Eclipse, Netbeans. Storing the image everywhere, the same folder as the main file and so on. Java 8. Is there a method in JavaFX to store files or did you mean storing it in my hdd? – Johan Rovala Feb 05 '15 at 13:16
  • I meant storing it in your JavaFX application. Like Uluk Biy did in the link above. – Roland Feb 05 '15 at 14:04

0 Answers0