Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the font size for strings in a JTable?

String columnNames[] = {"Time","MAP","ICP","CPP"};
String dataValues[][]= new String [countery]

table = new JTable( dataValues, columnNames );

I am working on a table and storing string values in dataValues. I am curious to know if there is anyway to increase the font size from the default size (which is I assume regular 11 font). This brings my other question...even font color?

like image 559
razshan Avatar asked Jun 01 '11 18:06

razshan


People also ask

How do you change the font size in a string in Java?

Font f = new Font("serif", Font. PLAIN, fontSize); The fontSize parameter will determine the size of your Font . You can't actually change the size of an existing Font object.

Which option reduces the size of the text?

To increase the font size, press Ctrl + ] . (Press and hold the Ctrl , then press the right bracket key.) To decrease the font size, press Ctrl + [ . (Press and hold the Ctrl , then press the left bracket key.)


1 Answers

table.setFont(new Font("Serif", Font.BOLD, 20));
like image 142
mKorbel Avatar answered Oct 12 '22 23:10

mKorbel