Selecting values in the JTable cell while editing

Hi

While I try to edit any value in table cell, editor positions the cursor at the end of the value but I want it select the whole value so that if the user want to enter new value, separate action for deletion of existing value is not required. Suppose, there is a value 245.05 is a specific cell of my table. What ever I write in this cell while editing (without manual selection) it should override the existing value of 245.05.

I searched the web but could not figure out the appropriate solutions.

Can anyone help?

Regards,

Mortoza

[573 byte] By [mortozaa] at [2007-11-26 16:24:21]
# 1
http://forum.java.sun.com/thread.jspa?threadID=212431&messageID=729256
macrules2a at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 2
Hi macrules2Thanks. Can you let me know more about the code available in the link you provided? How do I use that class given by 'goldt'?Regards,Mortoza
mortozaa at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 3
Hi macrules2I have extended my table from ProjectionsTable(); it is ok? I don't see any change!Can anyone help?Mortoza
mortozaa at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 4
I'm not the author of the original piece, but you should be able to figure out how to do something similar in your code.If you still have difficulty, then post specific questions here. "It doesn't work" isn't really a question.
macrules2a at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 5
Hi Macrules2I am not sure I understood your suggestiom. Anyway I'm still waiting if someone can help how to override old value in jtable while writing new value automatically like excel.RegardsMortoza
mortozaa at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 6
Here is my attempted solution: http://forum.java.sun.com/thread.jspa?forumID=57&threadID=640471Next time you multi-post you won't get an answer.
camickra at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 7

Hi camickr

Thanks for the suggestion. I checked your code from the link. I have ran your code and found

1) the 1st key in of text/number is vanished, only 2nd key in texts displayed. e.g. if I type 700 on this cell, only 00 is remained visible.

2) How do I validate data type i.e. numeric, date etc.?

Thanks in advance for the help.

Mortoza

mortozaa at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 8

> 1) the 1st key in of text/number is vanished, only 2nd key in texts displayed

Works fine for me using JDK1.4.2 on XP

> 2) How do I validate data type i.e. numeric, date etc.?

Override the getColumnClass method to return the appropriate class type and the appropriate editor will be used.

camickra at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 9
Hi CamickrI'm using JDK1.6 on windows server 2003 Sp1. Can I still get help?Thanks in advane for the help,Mortoza
mortozaa at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 10
I gave you code that works on JDK1.4.2. If it doesn't work on JDK6, I can't help you since I don't use JDK6. Try using some of the concepts I gave you and see if you can fix the code.
camickra at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...
# 11
Hi Anyone can help, please?Rgds,Mortoza
mortozaa at 2007-7-8 22:48:15 > top of Java-index,Desktop,Core GUI APIs...