# Jtable make cells only accepte numbers

ayoub belkas

Greenhorn

Posts: 14

Campbell Ritchie

Marshal

Posts: 52580

119

posted 1 year ago

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

posted 1 year 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".