JTextArea

Does anyone know how to set font to a JTextArea?

I kknow I've to use : setFont(Font f) where

Font f = new Font (String name, int style, int size)....

I don't know how to specify name and style........

Also I want to start writing from the center of the Text...how's that possible?

For TextField there is a function called

setHorizontalAlignment( SwingConstants.CENTER) ;

is there anything for JTextArea?

[462 byte] By [shailaU] at [2007-9-26 2:16:28]
# 1

> Font f = new Font (String name, int style, int size)....

> I don't know how to specify name and style........

Here are some examples:

new Font("Monospaced", Font.BOLD, 10);

new Font("Symbol", Font.PLAIN, 12);

new Font("Serif", Font.ITALIC, 14);

new Font(null, Font.BOLD|Font.ITALIC, 10);

The last one uses the default font.

> Also I want to start writing from the center of the

> Text...how's that possible?

It's not.

nerd2004 at 2007-6-29 9:14:57 > top of Java-index,Archived Forums,Swing...