BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   Custom fields (http://www.blackberryforums.com/developer-forum/264987-custom-fields.html)

himanshuguptagupta 08-09-2013 08:19 AM

Custom fields
 
Hello Everyone.
I wish to create a custom field.So I extend my class with Field and gave the body of paint and layout methods.And then draw a rectangle in paint method.
Now i wish that my rectangle should be clickable and events can be trapped on it when user clicks.
Please help me out to make the rectangle clickable and to trap events on it.
A part of my code is:

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



All times are GMT -5. The time now is 01:28 AM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.