0

Is there any way to accept only double values in a JTextField using documentfilter?

pixylife
  • 463
  • 4
  • 12

1 Answers1

4

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

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366