BlackBerry Forums Support Community

BlackBerry Forums Support Community (
-   Developer Forum (
-   -   Custom fields (

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:


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) {


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

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

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