如何将css转换为bss [英] How to convert css into bss
问题描述
我找到此信息 http://docs.oracle.com/ javafx / 2 / deployment / packaging.htm#BABCACBD
你能告诉我如何使用这个工具将css文件转换为bss文件?从网站上的信息,它不是很清楚如何使用它的JavaFX应用程序。
Can you tell me how I can use this tool to convert css files into bss files? From the information on the web site it's not very clear how I can use it for JavaFX application.
任何帮助将非常感激。
Any help will be highly appreciated.
推荐答案
让我们想象你的jdk 8 home bin目录在你的shell路径上。
Let's imagine your jdk 8 home bin directory is on your shell path.
创建Love.java :
Create Love.java:
import javafx.stage.*;
import javafx.application.*;
import javafx.scene.control.*;
import javafx.scene.*;
public class Love extends Application {
public void start(Stage stage) throws Exception {
Scene scene = new Scene(new Label("hello, world"));
scene.getStylesheets().add("love.css");
stage.setScene(scene);
stage.show();
}
}
编译:
javac Love.java
love.css :
.label { -fx-text-fill: firebrick; }
编译:
javafxpackager -createbss -srcfiles love.css -outdir . -outfile love
这将创建 love.bss
现在你可以删除 love.css
,因为你不再需要它了,因为你做了二元恋
Now you can delete love.css
as you don't need it anymore as you have made binary love.
现在运行您的应用程序:
Now run your app:
java Love
即使您请求了 love.css
是聪明的,足以识别你有一个二进制 love.bss
,并使用它来应用css样式到你的应用程序。
Even though you requested love.css
, the JavaFX runtime was smart enough to recognize that you have a binary love.bss
and use that to apply css styles to your app.
这篇关于如何将css转换为bss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!