How to set style color for a line in javafx?

17,541

Use -fx-stroke for coloring lines (using CSS)

line.setStyle("-fx-stroke: red;");

Or call setStroke() for coloring lines (using Java API):

line.setStroke(Color.RED);
Share:
17,541

Related videos on Youtube

gal kogeman
Author by

gal kogeman

Updated on September 16, 2022

Comments

  • gal kogeman
    gal kogeman over 1 year

    How to set style color for a line in javafx?

     public void setColor(String color) {
          for (int i = 0; i < 9; i++){ 
              //lines[i].setFill(Color.BLUE);
              //lines[i].setStyle("-fx-Background-color: yellow;");
              //lines[i].setStyle("-fx-color:"+ color);
             //setStyle("-fx-Foreground-color:"+ color);
          }
    
      }
    

    All 4 comments do nothing the lines not colored.

    I would be happy if you could help me.