JTable Cell length

Hi , How to fix cell length of the Jtable of a particular column.For ex column2 in my JTable accepts only 5 chars.How to do that?Thanks in advance.
[168 byte] By [Ramsha] at [2007-10-3 3:53:13]
# 1
Hi,to fix the cell length you may use this method :your_jtable.getColumnModel().getColumn(2).setPreferredWidth(200);
Marco_Poloa at 2007-7-14 21:51:00 > top of Java-index,Desktop,Core GUI APIs...
# 2
I think the OP wants to restrict input, not set the physical width.You need to provide a TabeCellEditor implementation which provides a restricted JTextField where appropriate - eg a JFormattedTextField or a JTextField with a custom Document.
itchyscratchya at 2007-7-14 21:51:00 > top of Java-index,Desktop,Core GUI APIs...
# 3
>>I think the OP wants to restrict input, not set the physical width.This is exactly what i want,please can you give some sample code.
Ramsha at 2007-7-14 21:51:00 > top of Java-index,Desktop,Core GUI APIs...
# 4
Knock yourself out, http://www.google.co.uk/search?hl=en&q=jformattedtextfield+maximum+length&btnG=Google+Search&meta=
itchyscratchya at 2007-7-14 21:51:00 > top of Java-index,Desktop,Core GUI APIs...
# 5
Thanks a lot, Got the answer
Ramsha at 2007-7-14 21:51:00 > top of Java-index,Desktop,Core GUI APIs...