Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Jtable make cells only accepte numbers  RSS feed

 
ayoub belkas
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi need some help to create a cell editor that make the cell only accept numbers
thank you
 
Campbell Ritchie
Sheriff
Posts: 53769
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read the appropriate Java™ Tutorials section? It has a section about editors, about halfway down.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The short answer from that tutorial is (probably) that you just have to make sure that the cell's type is Integer. You'd do that in your table model.

I'm assuming that accepting "only numbers" means "only digits". If you make your cell's type Integer then you can also enter negative numbers, and the numbers can't be more than 2^31 in absolute value. And you can't enter numbers with decimal points... anyway what I'm saying is that you might have to look more closely at what you mean by "only numbers".
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!