Change selected font color in EditField / BasicEditField / RichTextField in blackberry?

I am preparing a new application, I just want to create it TextField.

I have to provide functionality to select a piece of text and change its color. For example: hi, I'm a BlackBerry developer . Now I want to change the font color of the Blackberry developer at run time.

Is this possible in EditFieldor BasicEditFieldor RichTextFieldin any? Thanxx in advance! :)

+3
source share
1 answer
LabelField labelField2 = new LabelField("hello, I am blackberry developer",Field.FOCUSABLE){

        boolean _inFocus = false;
        public void onFocus(int direction) {
            _inFocus = true;
            this.invalidate();
        }
        public void onUnfocus() {
            _inFocus = false;
            this.invalidate();
        }
        protected void paint(Graphics graphics) {
             if(_inFocus){
                 graphics.setColor(Color.BLUE);
             }else{
                 graphics.setColor(Color.RED);
         }
          super.paint(graphics);
       }
       protected void drawFocus(Graphics g, boolean on) {
      }
    };

Enjoy ...

+1
source

All Articles