javaswingcomboboxsynth

styling Combobox in Java using Synth


Hello i want to set the background for the combobox i have to another color except from white, and during rendering when the user clicks to choose from the items inside how do i achieve that using synth??

Thanks in advance!


Solution

  • the solution came after the fact that the combobox uses a list to display its inner things so thats what should be changed... so i did:

    <style id="style">
    <opaque value="TRUE"/>
    
    <state>
      <color value="WHITE" type="TEXT_FOREGROUND"/>
      <color value="RED" type="TEXT_BACKGROUND"/>
      <color value="RED" type="BACKGROUND"/>
    </state>
    <state value="SELECTED">
      <color value="RED" type="TEXT_FOREGROUND"/>
      <color value="WHITE" type="TEXT_BACKGROUND"/>
    </state>
    

    `