|
-
December 15th, 2009, 04:32 PM
#1
What to Override?
hey group
I'm using a JTable in an application in which I changed the font of the text written inside the cells and header. My problem, during the 'editing' process of each cell (when the user actually enters text), the font returns back to the normal size. I'm trying to keep the font the same throughout before/after entering text, but I not succeeding.
I pickup through my searching, that I should override getCellRenderer and/or getCellEditor methods. I'm assuming the renderring is fine since my text remains and shows the font I gave it, so I'm working to override getCellEditor().
I'm a bit confused because if I override a method, I then will have to develop the entire routine when all I want to do is adjust the font used within getCellEditor(). So I turned my attention to creating/altering a CellEditor object by creating a custom class that "extends" a TableColumn. Afterall, the cellEditor is used to control a single column of a table. (unless I misread something)
I don't know... I feel I have pieces of ideas but I can't put them all together in a working fashion. Can anybody assist me with this?
Code:
class myCellEditor extends TableColumn
{
public myCellEditor()
{};
public TableCellRenderer getCellRenderer(JTable tbl)
{
Font ftTextCell = new Font("Dialog", Font.PLAIN, 8);
tbl.setFont(ftTextCell);
TableCellRenderer renderer = tbl.getCellRenderer(1,1);
return renderer;
}
protected TableCellEditor cellEditor()
{
Font ftTextCell = new Font("Dialog", Font.PLAIN, 8);
}
}
**my code isn't a piece of art, its a work in progress**
-= the best is yet to come =-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|