package mypackage;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
public class sample extends MainScreen implements FieldChangeListener
{
ButtonField click;
LabelField x,y;
public sample()
{
x=new LabelField("Left(x) position: ");
add(x);
y=new LabelField("right(y) position: ");
add(y);
click=new ButtonField("Get My Positions",Field.FOCUSABLE);
click.setChangeListener(this);
add(click);
}
public void fieldChanged(Field field, int context) {
System.out.println("============================"+click.getLeft()+" "+click.getTop());
x.setText("Left(x) position: "+click.getLeft());
y.setText("right(y) position: "+click.getTop());
}
}