i have a ComboBox named 'ComboBox_status' which have default values 'In Operation' and 'Disposed'
i want the background color to change to red when 'Disposed' is selected and green when 'In Operation' is selected.
this is the code i tried but it changes the background to red for both of them when they are selected
String age="Disposed";
if("Disposed".equals(age)){
ComboBox_status.setBackground(Color.red);
ComboBox_status.setForeground(Color.BLACK);
}
else{
ComboBox_status.setBackground(Color.GREEN);
ComboBox_status.setForeground(Color.darkGray);
}
i will appreciate it if anyone could help me resolve this THANK YOU.