Hi!
Im working with an extended jtable, in the constructor, I set the font
size and the rowHeight,
htfFont = new Font("Courier", Font.PLAIN, 15);
this.setFont(htfFont);
this.setRowHeight(htfFont.getSize() + 3);
the font seems to only take effect after exiting the cell, when it is
being editted it looks quite small. I would expect that there should be
an easy way to do this rather than creating a new tablecelleditor and
tablecellrenderer classes.. and ideas?
thanks
zero - 29 Nov 2005 17:58 GMT
"tiewknvc9" <aotemp@hotmail.com> wrote in news:1133274793.353121.112970
@o13g2000cwo.googlegroups.com:
> Hi!
>
[quoted text clipped - 11 lines]
>
> thanks
If I'm not mistaken (but don't shoot me if I am) the default cell renderer
for plain text is a JLabel (or a subclass of it), and the editor is a
JTextField (again, or a subclass). If that is indeed so, you could
override JTable:getCellRenderer and JTable:getCellEditor - you wouldn't
need to create your own renderer/editor.
public TableCellRenderer getCellRenderer(...)
{
TableCellRenderer renderer = super.getCellRenderer(..);
renderer.setFont(new Font(...));
return renderer;
}
Without looking at the JTable source I'm not sure if you should override
getRowHeight as well. I'm guessing no, it probably just returns the height
of the heighest component in the row.

Signature
Beware the False Authority Syndrome