0

i want to make required field validator in java netbeans
on textfield and press button if textfield null or example the textfield required string no integer how do it

2
Contributors
1
Reply
6
Views
4 Years
Discussion Span
Last Post by stultuske
0

ehm ... a textfield will always contain a String, even if you input numbers.
something like

actionPerformed(ActionEvent e){
 if ( myTextField.getText().equals("")){
  // print error message
  return; // or throw an Exception
  }
  // normal flow
}

should do the trick

but this is not in the least related to NetBeans.

Edited by stultuske

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.