Hi everyone,
I'm facing a problem with absolute URLs for images in a CSS file using JavaFX 2.2.3. Given the following FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import java.net.*?>
<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:id="root">
<stylesheets>
<URL value="@/com/twasyl/testerfx/resources/style/TesterFX.css" />
</stylesheets>
<children>
<Button prefHeight="128" prefWidth="128">
<styleClass>
<String fx:value="testButton" />
</styleClass>
</Button>
</children>
</AnchorPane>
And the given CSS file:
.testButton {
-fx-background-image: url('/com/twasyl/testerfx/resources/images/globe.png');
-fx-background-repeat: no-repeat;
}
The display is absolutely correct using NetBeans 7.2.1 but in IntelliJ 12 the image is not displayed. But if in my CSS file I use relative URL like this:
.testButton {
-fx-background-image: url('../images/globe.png');
-fx-background-repeat: no-repeat;
}
it's working in both NetBeans and IntelliJ. I've also tried to the URL locator by adding a @ at the beginning of the URL, without success. So I was wondering if it's more an IDE issue, or JavaFX one. Have anyone encounter this problem?
Thank you.