BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   Custom fields (http://www.blackberryforums.com/showthread.php?t=264987)

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:55 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.