user340151
user340151

Reputation:

How to change Label color in Blackberry using eclipse

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

Upvotes: 1

Views: 1160

Answers (1)

Vivart
Vivart

Reputation: 15313

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);
            }

        };

Upvotes: 2

Related Questions