How do you change the background color of a TextField without changing the border in javafx?

后端 未结 4 1417
离开以前
离开以前 2020-12-31 10:00

I am trying to change the background color of my TextField \"colorBox0\" to \"value0\" but it gets rid of the border.
Here is a simplified version of my code:

         


        
4条回答
  •  囚心锁ツ
    2020-12-31 10:12

    I found that you can construct a string of css code out of a string and a variable by using the to string method and the substring method like this:

    colorBox0
    .setStyle("-fx-control-inner-background: #"+value0.toString().substring(2));
    

提交回复
热议问题