wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes Character width Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Character width" Watch "Character width" New topic
Author

Character width

kishor patankar
Greenhorn

Joined: Sep 25, 2000
Posts: 13
hi!! Friend,
Is it possible to define the fix characters width in the TextField? Pl. post the code if possible.
thanks,
Kishor
sashkamal
Greenhorn

Joined: Feb 05, 2001
Posts: 4
Originally posted by kishor patankar:
hi!! Friend,

Is it possible to define the fix characters width in the TextField? Pl. post the code if possible.

thanks,

Kishor
hi,
i think u can use setFont(new Font "font name",style,size)
hope this solves ur problem.

bye
sashkamal
------------------
sashkamal


sashkamal
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Kishor,
I think the "MonoSpaced" font is your best bet. For example:
Font f = new Font( "MonoSpaced", Font.PLAIN, 12 );
Regards,
Manfred.
kishor patankar
Greenhorn

Joined: Sep 25, 2000
Posts: 13
'Monospace' don't have feeling. Any other way!!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Character width