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

后端 未结 4 1445
离开以前
离开以前 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:14

    Elegant solution with colour translation:

    static Paint black = Paint.valueOf(Integer.toHexString(Color.BLACK.hashCode()));
    TextField textfield;
    textField.setStyle(
    "-fx-control-inner-background: #"+black.toString().substring(2));
    

提交回复
热议问题