The moose likes Applets and the fly likes how to change the font? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "how to change the font?" Watch "how to change the font?" New topic
Author

how to change the font?

Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
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
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
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
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
Simon,
If you are using Swing, you might be able to use JEditorPane to get the result you describe.
Stephanie
 
 
subject: how to change the font?
 
Threads others viewed
How to resize brower when Applet is resized?
changing font type and size
Setting label font and text color
Swing / JFC / AWT
MenuItem font setting

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture