我喜欢 ProgressIndicator,但我想更改它的颜色和圆圈宽度。是否可能(有或没有 css)?
最佳答案
当然,这很容易。
你可以在文档中找到所有相关的方法和样式:
- API:http://docs.oracle.com/javafx/2/api/index.html?overview-summary.html
CSS:http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#progressindicator
public class HelloProgressIndicator extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { Pane root = new Pane(); Scene scene = new Scene(root, 200, 200); ProgressIndicator pi = new ProgressIndicator(.314); // changing color with css pi.setStyle(" -fx-progress-color: red;"); // changing size without css pi.setMinWidth(150); pi.setMinHeight(150); root.getChildren().add(pi); stage.setScene(scene); stage.show(); } }
关于java - 是否可以设置 ProgressIndicator 的样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11184255/