Java Swing: Implementing a validity check of input values

前端 未结 4 968
猫巷女王i
猫巷女王i 2020-12-31 16:08

In my Swing application, the user must insert numbers and values, before switching to the next window. Now as a clean program should, I check every input if its valid or not

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-31 16:33

    You can get real time validation through the use a DocumentFilter

    You check out this and this for some examples.

    I do think, however, you might find the JFormattedTextField are more suitable solution in this case.

提交回复
热议问题