# Jtable make cells only accepte numbers

ayoub belkas

Greenhorn

Posts: 14

Campbell Ritchie

Sheriff

Posts: 50637

82

posted 8 months ago

Have you read the appropriate Java™ Tutorials section? It has a section about editors, about halfway down.

posted 8 months ago

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".

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".