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
Joined: Jun 14, 2000
Posts: 347
posted
0
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
Joined: Aug 16, 2000
Posts: 235
posted
0
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
Joined: Jul 17, 2000
Posts: 124
posted
0
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
Joined: Jun 14, 2000
Posts: 347
posted
0
Simon, If you are using Swing, you might be able to use JEditorPane to get the result you describe. Stephanie