Skip to main content

ComboBox - List

4 replies [Last post]
seik
Offline
Joined: 2008-07-03
Points: 0

Hello Again! ^^
Told you that I would came back, right? lol
Well...my new problem is this:

I create a comboBox, add a ListCellRenderer() to it and put a Style to both of them(comboBox and LCR), then everything looks fine but a line(the border?padding?) of the list of items of the comboBox that is still green.
So here is the question: how do I change it(the light green border/padding of the itemList from inside the combo box)'s color?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

Hi,
I'm not clear on whether the line is on the list or on the items.
Regardless you can disable the border by invoking
myCmp.setBorderPainted(false);

Thanks,
Shai

> Hello Again! ^^
> Told you that I would came back, right? lol
> Well...my new problem is this:
>
> I create a comboBox, add a ListCellRenderer() to it and put a Style
> to both of them(comboBox and LCR), then everything looks fine but a
> line(the border?padding?) of the list of items of the comboBox that
> is still green.
> So here is the question: how do I change it(the light green border/
> padding of the itemList from inside the combo box)'s color?
> [Message sent by forum member 'seik' (seik)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284427
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

seik
Offline
Joined: 2008-07-03
Points: 0

T_T didn't work =p

hum..I'll try to explain again:
I created a combobox, put the items inside and set a style on the combobox and ListCellRenderer();
then when I test it, the closed comboBox looks fine, but when I click on it to select a item, the "box" where the items appear (to be selected) has a border with green color...
[ComboBox]
|---------------| < ----- this
| Item |
| Item 2 |
|---------------|

Can I change its color?
(sry for my bad skill at drawing XD)

Message was edited by: seik

Message was edited by: seik

Message was edited by: seik

Message was edited by: seik

Shai Almog

Sorry, I missed the point about the combo box popup being the problem.
I'm afraid there is no way to customize this popup at this moment,
there might be something in the next drop but I can't guarantee that
since it might be a bit complex.

There is a workaround but it is REALLY, ugly...
Essentially install your own renderer on the combo box and when
rendering on something that isn't a combo box (the popup List) just
disable its border:
new DefaultListCellRenderer() {
public Component getListCellRendererComponent(List list, Object
value, int index, boolean isSelected) {
if(!(list instanceof ComboBox) {
list.setBorderPainted(false);
}
return super.getListCellRendererComponent(list, value, index,
isSelected);
}
}

We are reworking some of the border painting and style logic so
hopefully some of these things will get simpler to do.

Thanks,
Shai.

> T_T didn't work =p
>
> hum..I'll try to explain again:
> I created a combobox, put the items inside and set a style on the
> combobox and ListCellRenderer();
> then when I test it, the closed comboBox looks fine, but when I
> click on it to select a item, the "box" where the items appear (to
> be selected) has a border with green color...
>
> [ComboBox]
> |------------------| < ----- this
> | Item |
> | Item 2 |
> |------------------|
> Can I change its color?
> (sry for my bad skill at drawing XD)
> [Message sent by forum member 'seik' (seik)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284443
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

seik
Offline
Joined: 2008-07-03
Points: 0

thanks, better nothing than a green line on a black and blue layout ^^
until the fix I'll use it this way(with no border).