Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
icaro90302
Posts: 39
Registered: ‎09-28-2010
My Device: Not Specified

Change color of selected text in a RichTextField

Hi everyone!

 

I need to change the blue color that appears when you select text in a RichTextField.

 

I have this code:

 

_text = new RichTextField(this._contentText){
		protected void paint(Graphics g) 
	        {
	            g.setColor( Library.COLOR_FONT );
	            getManager().invalidate();
	            super.paint( g );
	        }
	    	
	    	protected void drawFocus(Graphics g, boolean on){
	    		XYRect focusRect = new XYRect();                
	            getFocusRect( focusRect ); 
	            int yOffset = 0;                
	         
	            if ( isSelecting() )     
	            {   
	                yOffset = focusRect.height >> 1;        
	                focusRect.height = yOffset;        
	                focusRect.y += yOffset;
	            }                
	            g.pushRegion( focusRect.x, focusRect.y, focusRect.width, focusRect.height, -focusRect.x, -focusRect.y );   
	            g.setBackgroundColor( Library.COLOR_BACKGROUND_ACTIVE ); // Color.WHITE
	            g.setColor( 0xFFFFFF );
	            g.clear();
	            this.paint( g );                
	            g.popContext();
	            
	            invalidate();
	    	}};

 

 

This code only changes the color of the cursor when you focus the text, but if I try to select text, you still see the blue color that is defined by default.

 

If anyone can help me would greatly appreciate it...

 

Thanks

 

Please use plain text.