Hello every one.
I wish to create custom fields , so i extend my class with Field class and gave the body of paint and layout methods.
In paint method i have drawn a rectangle.
Now i wish that the rectangle should be focusable and when user clicks on rectangle the event can be trapped.

Code:
package mypackage;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.container.MainScreen;


public final class rect extends Field
{
    public rect()
    {        
            
        
    }
   

	protected void layout(int arg0, int arg1) {

		setExtent(200,200);
		
	}

	protected void paint(Graphics g) {
		
		g.drawRect(20, 20, 160, 60);
		
		
	}
}
thanks