3

I am working on skinning a Combobox. A combobox is made up of multiple subcomponents one of which is a editor.
I have written a custom editor which has some custom functions and i have used combobox.setEditor(new CustomComboEditor()) to set the custom editor. I have defined the skin tag for editor in my skin xml file as shown below:

style id="skinnedComboTextStyle">
<state value="MOUSE_OVER">
<imagePainter method="textFieldBackground" path="/images/image1.png" sourceInsets="2 2 2 20" />
</state>
<state value="PRESSED">
<imagePainter method="textFieldBackground" path="/images/image2.png" sourceInsets="2 2 2 2" />
</state>
</style>
<bind style="skinnedComboTextStyle" type="name" key="ComboBox.textField" />

Note that combo UI synth implementation is SynthComboBoxUI and it has the binding setName(ComboBox.textField), hence I have used ComboBox.textField as key in the above tag.

I notice that when I have custom editors set as my combo editor the skin does not take effect.
But if I do not use any custom editors and rely on the default implementation of editor my skin works but then the functionality I intend to have in my combo editor does not take effect.

I face the same issue when I try to set a custom renderer for combo.

mKorbel
  • 108,320
  • 17
  • 126
  • 296

2 Answers2

0

You can override the createEditorComponent() from SynthComboBoxEditor and create a button with 2 labels and return this button as ur editor. Also override, setItem() method so that u set the text for these 2 labels separately.

0

I guess Nisha, you need to override other methods also from ComboBoxEditor class according to the requirement. Like you might have to modify in getItem() as well.