0

即使我在主题中将其设置为黑色,ComboBox 文本颜色也是白色的。TextField 的文本颜色应该是黑色的。为什么 ComboBox 文本颜色不是黑色的?

主题:

fgColor=FFFFFF  
bgColor=000000  
sel#fgColor=FFFFFF  
sel#bgColor=EE8207  
ComboBox.fgColor=000000  
ComboBox.bgColor=FFFFFF  
ComboBox.sel#fgColor=000000  
ComboBox.sel#bgColor=FFFFFF  
TextField.fgColor=000000  
TextField.bgColor=FFFFFF  
TextField.sel#fgColor=000000  
TextField.sel#bgColor=FFFFFF  
4

3 回答 3

1

您可以像这样更改文本颜色

Style selStyle = UIManager.getInstance().getComponentSelectedStyle("ComboBoxItem");
selStyle.setFgColor(0x00AF00);   // Selected Item will be in green color
UIManager.getInstance().setComponentSelectedStyle("ComboBoxItem", selStyle);

Style unSelStyle = UIManager.getInstance().getComponentStyle("ComboBoxItem");
unSelStyle.setFgColor(0x000000); // Selected Item will be in black color   
UIManager.getInstance().setComponentStyle("ComboBoxItem", unSelStyle);

这会成功的!!

于 2011-04-11T11:12:10.907 回答
0

您应该使用 hexColors: "0x000000" 或 "0xffffff"

您还可以使用以下方法在应用中设置颜色。

lwuit 使用 int 设置颜色,计算 int 使用以下函数。

public static int colorStringToInt(String hexColor) {
    int color;
    try {
        color = Integer.parseInt(hexColor.substring(2), 16);
        return color;
    } catch (Exception ex) {
        ex.printStackTrace();
        return -1;//no negative colors
    }
}

像这样设置颜色。

int color = AppUtils.colorStringToInt("0xffffff");//white
if (color != -1) {
    b.getStyle().setFgColor(color, true);
}
于 2010-12-09T16:13:50.440 回答
0

你可以这样使用,

ComboBoxItem.fgColor=000000  

ComboBoxItem.sel#fgColor=ffffff

你在使用 ResourceEdit。如果您不使用意味着使用 ResourceEdit 并创建主题。

于 2010-11-24T13:33:24.483 回答