Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to style ProgressIndicator?

I like ProgressIndicator, except I'd like to change it's color and circle width. Is it possible (with css or without)?

like image 935
Rogach Avatar asked Jun 25 '12 06:06

Rogach


1 Answers

Of course, it's very easy.

You can find all related methods and styles in doc:

  • 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();
     }
    }
    
like image 148
Sergey Grinev Avatar answered Oct 16 '22 22:10

Sergey Grinev