How to change Label color in Blackberry using eclipse

♀尐吖头ヾ 提交于 2019-12-11 10:29:24

问题


Can you please send me any example code on label color , by default it shows black color i want to change the color for look and feel in UI please help me ..

Thanking you


回答1:


you can do like this

  LabelField label = new LabelField("label"){
            protected void paintBackground(Graphics g) {
                g.setBackgroundColor(Color.BLUE);
                g.clear();
                super.paintBackground(g);
            }
        };

or like this

LabelField label = new LabelField("label"){
            protected void paint(Graphics g) {
                int oldColor = g.getColor();
                g.setColor(Color.BLUE);
                g.fillRoundRect(0, 0, getWidth(), getHeight(), 7, 7);
                g.setColor(oldColor);
                super.paint(g);
            }

        };


来源:https://stackoverflow.com/questions/3014109/how-to-change-label-color-in-blackberry-using-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!