Forums Register Login

How to change font in JTable?

+Pie Number of slices to send: Send
After converting from j2sdk-1.4 to j2sdk-1.3, I end up with big ugly fonts in my JTable. I can successfully change the column header fonts back withbut that doesn't change the font size in the table itself. Nor does:Anybody know how to change that stuff?
+Pie Number of slices to send: Send
You need to play with the TableCellRenderer and the method public Component getTableCellRendererComponent(...). Basically you need to return a JLabel after setting the font you needed. Having said that, it is unnecessary to do all this work for the assignment.
+Pie Number of slices to send: Send
Thanks Sai. I've determined that the problem is that I'm writing the cells as HTML, and 1.3 doesn't do HTML quite like 1.4. The reason I went to HTML was that I wanted to do some fancy formatting- however, I can do all that with a custom TableCellRenderer as you suggest, something like:And yeah, I know all this isn't really "necessary."
Hey! Wanna see my flashlight? It looks like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3372 times.
Similar Threads
Jtable cells
JTable
JTable
JTable
Subclassing JTable
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:06:47.