java - How to catch exception in GUI -


i'm trying catch if user enter number (integer) instead of name (string) in textfield.

but problem texts read string.

so how can implement that: if user enters number in name field, show him error message?

parse textfield int.

int name = integer.parseint(jtextfield.gettext()); 

if textfield has name (e.g john, mary,etc..) come out exception. if textfield has int (e.g 1, 2 ,etc..) parse.you can check using way.

or can tryformatted text fields maskformatter.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -