This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes TextField tf = new TextField( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "TextField tf = new TextField("this is for",40);" Watch "TextField tf = new TextField("this is for",40);" New topic

TextField tf = new TextField("this is for",40);

sarim raza
Ranch Hand

Joined: Nov 02, 2000
Posts: 232
what happens as a result ?
does the number of viewable characters depend on what kind of font we use ?
suppose font is fixed, will we then see 40 characters ?
If it is not fixed, is it impossible to see 40 characters?
if the string above was made larger to have more than 40 characters, would it be viewable or we would have to scroll using arrow keys to see it ?
umang bhartia
Ranch Hand

Joined: Sep 29, 2000
Posts: 60
Yes sarim u r right, the number of characters visible in a text field depends on the font u r using. If u provide a text field for 40 characters then its not possible to view 40 characters even if u change the font. The number of columns is a measure of the size of the text line according to the particular font used for rendering the text. However for a fixed pitch fonts, the number of columns is equal to the number of characters in the text line. Hope i m clear
I agree. Here's the link:
subject: TextField tf = new TextField("this is for",40);