Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
673 views
in Technique[技术] by (71.8m points)

javafx 2 - How to convert css into bss

I found this post http://docs.oracle.com/javafx/2/deployment/packaging.htm#BABCACBD

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Let's imagine your jdk 8 home bin directory is on your shell path.

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();
  }
}

Compile it:

javac Love.java

Create love.css:

.label { -fx-text-fill: firebrick; }

Compile it:

javafxpackager -createbss -srcfiles love.css -outdir . -outfile love

This will create love.bss

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

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.

love


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...