Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to change the font?

 
Simon Xu
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I connect applet with a server through socket, suing PrintWriter/Reader. How could I change the font of the string sent out by the server? In server side, or in applet? I may need change frequently.
Thanks
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Simon,
I am not sure I understand your question. The string sent out by the server is just data, it doesn't really have an associated font. Are you trying to change the font your client sees? If so, just set the font of the corresponding controls in your applet. For example, if your applet displays the server messages in a TextArea, then set the font of that TextArea.
If this is not what you meant, I am sorry I misunderstood. Please post again with more information.
Thanks.
Stephanie
 
Simon Xu
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, Stephanie
Thanks for your response.
Yes, I want to change the font in the TextArea. I use PrintWriter to write out the data (e.g. a text file) to browser, but I also need to format the output, like changing the font, size (in text file, there are head, title, second title, italic so on). Is it possible to do that? Thanks
 
Ashwin Desai
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can just change the font for the TextArea using setFont(). But, that would change the font of all data in the text area. I do not think that it is possible to change the font of a portion of the data.
Ashwin.
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simon,
If you are using Swing, you might be able to use JEditorPane to get the result you describe.
Stephanie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic