Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

TextField(int)  RSS feed

 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is it that when I make an AWT TextField(3) I get a text field with enough room for 5 characters?
JDK 1.3.1
Win
Drew
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The size of each column is based on an average character width. It seems like I remember it being based roughly from the width of a "w", but I'm not sure. So for example, if you have a couple "i"'s, then you will be able to fit in more characters.
 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, it's based on the particular font that you happen to be using at the time?
Drew
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it's based on the font you are using at the time.
From the java.awt.TextField api (I'm sure the defnition of a "column" is the same):
A column is an approximate average character width that is platform-dependent
 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, but if the font I'm using is 44 point, then it's not gonna fit.
Drew
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!