我尝试将CSS代码添加到我的java应用程序中,该CSS代码可以很好地处理所有CSS属性,除非它显示-fx- working image(“”) URL
CSS代码
.body
{
-fx-background-image: url("http://www.birds.com/wp-content/uploads/home/bird4.jpg");
}javafx代码
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

发布于 2021-04-04 18:10:27
忘记在此处添加错误对不起其: javafx.css.converter.URLConverter解决方案
https://stackoverflow.com/questions/66940086
复制相似问题