Firstly I want to emphasize that I'm talking about TextField in J2ME (javax.microedition.lcdui.TextField) not TextField in AWT (java.awt.TextField).
Could you tell me if this is possible in J2ME? I want to change the font (font family, font size, font color) of the TextField, I also want to change the width it is rendered on the form. I tried using setMaxSize() but this also limits the number of characters the TextField can contain. What I want is changing the TextField's width without limiting that number of characters.
If these couldn't be done, I don't think programmers can make their J2ME application look best. Or at least they would have another control which supports these features.
You can't change width and font of TextField in Java ME, API Javadocs for this class have nothing related to font (actually, the very word font isn't mentioned in these docs).
You are right but the reason for this limitation is that TextField and other high level UI API are intended to allow programmers write simple highly portable code (leaving details on what font to use on large/small screen to the system).
This is pretty well explained in lcdui package API docs, in section Structure of the MIDP UI API:
Regarding fonts, of high level UI API classes Choice implementations such as
ListandChoiceGrouphave some capabilities, but these are pretty limited, consult with API docs for details if you are interested.For fuller access to features you look for, study the "low level" part of the API, described in the package docs referred to above:
In particular, Graphics class has methods to get and set font - called respectively,
getFontandsetFont.Note by the way that features provided by Graphics could be "embedded" within Form using CustomItem API.