I create a midlet, inside that midlet I placed a Form
(javax.microedition.lcdui.Form
). Inside that form I placed a TextField
(javax.microedition.lcdui.TextField
).
I want to make the width of textfield is same as form's width.
Objects you refer to (javax.microedition.lcdui...
) belong to standard midp lcdui package, these have nothing to do with j2mepolish.
Method Form.getWidth() returns the width in pixels of the displayable area available for items.
Layout directives API is provided in MIDP in order to display TextFileld as you describe. You'll likely need to use directives that set it expandable and occupy a separate line.
These topics are discussed in more details in MIDP (JSR 118) API documentation for Form and Item:
It is worth keeping in mind that MIDP 2.0 allows device implementation to ignore layout directives, while since MIDP 2.1 these are specified as mandatory.
By Default it has width of form like
Form example = new Form("Example");
TextField test = new TextField("", "", 50, TextField.ANY);
example.append(test);
display.setCurrent(example);
I hope this will help you.
Thanks