How can i change JDateChooser background and foreground color

1.6k views Asked by At

I need to change JDateChooser background and foreground color, i changed the color using LaF property window,but nothing happens

enter image description here

Then i also used following code to solve this,

BorrowDateChooser.setBackground(new Color(51,51,51));

but it also not working for me,what can i do for this problem

1

There are 1 answers

0
Chauncey Lee On

Use code below to change the jdatechooser background:

       for( Component c : jDateChooser1.getComponents()){
((JComponent)c).setBackground(Color.RED); 

}

  for( Component c : jDateChooser2.getComponents()){
((JComponent)c).setBackground(Color.RED); 

}

the result of example picture: enter image description here