This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a Text Field in my Jframe. Is there any Exception which throws it self when we called textfiled.getText() without entering anything in it .
What I want to do is if the user does not input anything on the text field and press "OK "button it should throw an Exception.Is there any way to do this ?
[Bsc in Computer Science and Engineering] [SCJP 80%][BCS certificate level]
If you are simply trying to let the user know they must enter something into the TextField, then when you use getText(), check if the length of the returned String is > 0, and if it isn't then display a warning message to the user.