I have a screen designed in Swing, for modifying the records in a table in Access database. The screen is working fine. There is only one column that is editable. user types some name in the column 'Player Name'. After pressing tab or clicking on other cell, the text is changing to some junk characters. However, the correct text is stored in the table. If the same screen is opened again, it shows the correct text under the Player name column. If I click on any cell under Player Name column, it again shows junk characters. I have attached a screen shot. The code of the program is given below :
Please look into it and give me a solution. Thanks in advance.
G Kiran Kumar
Greenhorn
Joined: Apr 12, 2009
Posts: 14
posted
0
The screen shot was not attached to the previous post.
pete stein
Bartender
Joined: Feb 23, 2007
Posts: 1561
posted
0
I am no pro at this, far from it, but it looks as if your last column of the JTable is trying to display the default toString for a byte array rather than display a true String.
Please read your private messages regarding an important announcement.
Thank you,
Rob
pete stein wrote:I am no pro at this, far from it, but it looks as if your last column of the JTable is trying to display the default toString for a byte array rather than display a true String.
Very true indeed. You can remedy this by supplying a custom TableCellRenderer and adding that to the TableColumn, or perhaps making getColumnClass return a different class for that column and using JTable.setDefaultRenderer for that class.
I will acquint myself with the words
TableCellRenderer , getColumnClass and JTable.setDefaultRenderer etc and come back to your help, if needed.
G Kiran Kumar
Greenhorn
Joined: Apr 12, 2009
Posts: 14
posted
0
I googled and found some info. Created a new custom cell renderer. Its code is :-
I have set this cell renderer in my previous java file. Still it is NOT working The full code of this java file where JTable is being used, is given below
Please help me. Thanks in advance.
G Kiran Kumar
Greenhorn
Joined: Apr 12, 2009
Posts: 14
posted
0
One observation .........
with the earlier code, only the cell that was modified used to display junk characters. after adding this cell renderer, if I edit text in any row and press tab key, all rows under this player name column are showing junk characters only. Please help me.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Cell showing junk chars after mouse click