Can someone tell me what is the actual difference between Fixed width and Proportional width font? And also how this affect text field. TextField(int n) is the constructor n is the number of visible columns. Suppose n is 15. If i am displaying i then I can see more than 15 i, but if i want to see w i can see less then 15 colums. Why does this occur. Please throw some light on this point.
Hi Parag, It happens when the Font is Proportional Width Font. when You create TextField of width 15, the actual width is calculated by multiplying 15 by avg width of all letters in the Font. so if you type 15 W's which is widest letter, than you won't see all. but the Font is Fixed width, it is different, every letter has fixed width, and when the text field was created it will use that fixed width * 15. so when you type a letter , you will see everything as long as they are 15 letter long. Correct me if I am wrong, Gurus.. Thanks.
Hi Parag: Whenever you create a textfield object specifying the number of visible columns, to be 15 in this case, THE ONLY TIME WHEN YOU WILL ACTUALLY SEE 15 CHARACTERS will be when the textfield has its preferred size AND the font is of a fixed width. preferred size: means that it has its actual size as allowed by the Flow layout fixed width font: means that the size of all columns will be the same and will compress a 'w' char to be in the same size column like an 'i' char. proportinonal width font: a 'w' char will occupy more space than an 'i' and the column size will be the average width of all the characters. you seem to be using a proportional width font, which will cause the 'w' to go beyond the display area, but will cause you to see more than 15 'i' s try a fixed font like monospaced.
Joined: Sep 01, 2000
Hi It really nice sean and sarim I got most of what you are saying. But how can i decide wheather i am using Fixed/Proportionate Font? Can you explain it?