Is there any way to accept only numeric values in a JTextField?

前端 未结 19 2288
陌清茗
陌清茗 2020-11-22 03:10

Is there any way to accept only numeric values in a JTextField? Is there any special method for this?

19条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 04:14

    numberField = new JFormattedTextField(NumberFormat.getInstance());

    Formatted text field tutorial

提交回复
热议问题