Home arrow static arrow Java Programming [Archive] - Stupid question, char and getFont
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Stupid question, char and getFont
This topic has 3 replies on 1 page.

Posts:38
Registered: 2/12/04
Stupid question, char and getFont  
Aug 3, 2004 4:56 AM



 
Hello

Im wondering if it is possible the get the Font used when a char was typed:
ex;
Char[] charArray = textArea.getText().toCharArray();
//something like
System.out.println(charArray.getFont());

or is this information lost (or never gained) in the process of transfer the text from the textArea to the charArray?

Thankful for response
Fred
 

Posts:2,830
Registered: 9/1/03
Re: Stupid question, char and getFont  
Aug 3, 2004 5:00 AM (reply 1 of 3)



 
or is this information lost (or never gained) in the
process of transfer the text from the textArea to the
charArray?

yep !
 

Posts:8,813
Registered: 10/4/00
Re: Stupid question, char and getFont  
Aug 3, 2004 5:02 AM (reply 2 of 3)



 
Font is an attribute of the textarea, not the text.
 

Posts:441
Registered: 2/25/04
Re: Stupid question, char and getFont  
Aug 3, 2004 5:04 AM (reply 3 of 3)



 
The font is a property of the text component, not the characters. They are just Unicode codepoints- plain numbers. If you want the font for the textArea, use its getFont() method. If you want to pass both a font and a string around, create your own class to hold that data.

Pete
 
This topic has 3 replies on 1 page.