09-01-2009 04:18 AM
hi,
I am developing a login password screen for my application.
EditField user=new EditField("User ID:","",10,EditField.FIELD_HCENTER|EditField.FIELD
PasswordEditField password=new PasswordEditField("Password:","",10,PasswordEditFi
Functionality wise its ok but i am just wondering how can i
1. draw editfield into the centre of the screen
2. how can i change the background color of the fields.
Solved! Go to Solution.
09-01-2009 04:47 AM
Hi,
Plz. go thru the properties of these fields. There are properties like
(1.) EditField.FIELD_HCENTER and EditField.FIELD_VCENTER,which are inherited from " class net.rim.device.api.ui.Field".
Also you can use Mangers like HorozontalFieldManager and VerticalFieldManager to make it align as you wish..
(2.)You will have to override: public void paint(Graphics g){ }
09-01-2009 05:00 AM
I have already tried these VCENTRE AND HCENTERE abut they don't work in my case.
I want to put these two fields in the centre of screen.
Any Suggestions!
09-01-2009 05:44 AM - edited 09-01-2009 05:46 AM
how are you adding the field to your screen?
Make a custom Manager that will help you place the fields as u like...
CustomManager cmanager = new CustomManager();
cmanager.add (user);
cmanager.add(password);
add(cmanager);
The customManager class would extend manager... and it overrides the sublayout method that positions the children of manager..
something of this sort...
private class CustomManager extends Manager {
protected CustomManager() {
super(NO_VERTICAL_SCROLL);
}
protected void sublayout(int width, int height) {
if (getFieldCount() > 0) {
layoutChild(user, width, height);
layoutChild(password, width, height);
int y = 10; //this is assumption
setPositionChild(user, (Display.getWidth()- user.getContentWidth())/2, y);
y += user.getContentHeight();
setPositionChild(password, (Display.getWidth() - password.getContentWidth())/2, y);
setExtent(width, Display.getHeight());
}
}
}