B4J Question Help right-aligning combo box items

Hello everyone.
I'm having a really hard time making this work. I have a combo box and I need to align all of the entries to the right of the dropdown list. I've searched the forum and tried different things without luck:

1. Using CSSUtils:

CSSUtils.SetStyleProperty(CBOX_ProductType, "-fx-text-alignment", "right")
2. Applying the property directly:

CBOX_ProductType.Style = "-fx-text-alignment: right"
3. Adding the comboBox entires as individual labels

myLabel.Initialize("")
myLabel.Text = "SHOOT ME!"
myLabel.Alignment = "CENTER_RIGHT"
'It DOES change if I add the follwing line, but messes with the automatic comboBox width:
'myLabel.SetSize(CBOX_ProductType.PrefWidth, CBOX_ProductType.PrefHeight)
CBOX_ProductType.Items.Add(myLabel)
4. This solution DID work, but with a serious side-effect (which I shall mention) :

Dim myLabel As Label
Dim myPane As AnchorPane
myPane.Initialize("")
myLabel.Initialize("")
myLabel.Text = "SHOOT ME!"
myLabel.Alignment = "CENTER_RIGHT"
myPane.AddNode(myLabel, 0, 0, -1, -1)
myPane.FillHorizontally(myLabel, 0, 10)
CBOX_ProductType.Items.Add(myPane)​

The problem with the last solution is that everything seems perfect at first, but once I click and select an item on the list, its text appears (as the chosen item) in white, hardly discernible! and even worse, the item's text disappears from the dropdown list (the space is there, but the word itself is gone).

I really need to make this work and it's driving me crazy! Any help is appreciated!
Thank you so much in advance.

P.S. I can't even make the text in a TextField aligned to the right. Please help me.
 
Last edited:
[SOLVED]
Well, after beating my brains for a couple of days I figured out the solution myself. I thought I'd post it here in case anyone is interested:
Just add these 2 lines to your code:

Dim jo As JavaObject = myComboBox
jo.RunMethod("setNodeOrientation", Array("RIGHT_TO_LEFT"))​

There you have it!
 
Top