Is there any way to accept only double values in a JTextField using documentfilter?
You will want to use a DocumentFilter
This will allow you to "filter" the incoming content before it reaches the document.
Check out these examples for more ideas
You could also try look at a JFormattedTxtField
which would probably be easier, but where's the fun in that