Rog*_*ach 11 java javafx javafx-2
我喜欢ProgressIndicator,除了我想改变它的颜色和圆宽.是否可能(使用css或不使用)?
Ser*_*nev 18
当然,这很容易.
您可以在doc中找到所有相关的方法和样式:
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();
}
}
Run Code Online (Sandbox Code Playgroud)| 归档时间: |
|
| 查看次数: |
11450 次 |
| 最近记录: |