This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript 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: 55333
157
  • 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: 22374
42
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".
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!