C
Cruella DeVille
Hey
I'm trying to create a method that checks input from an array of
JTextField. I thought the trim() method from String automatically was
loaded, but I keep getting the "method not defined in class Form" (of
type JInternalFrame)
I also thought that the return of JTextField.getText() was a String so
that I could use the trim() method in this, but no.
Some code:
public boolean checkInput(){
for(JTextField content : textFields){
if(trim(content.getText()).equals("")){
return false;
}
}
return true;
}
private String trim(String string){
String s = trim(string);
return s;
}
Why am I getting the StackOverFlowException from this code? I'm
obviously missing something here.
I'm trying to create a method that checks input from an array of
JTextField. I thought the trim() method from String automatically was
loaded, but I keep getting the "method not defined in class Form" (of
type JInternalFrame)
I also thought that the return of JTextField.getText() was a String so
that I could use the trim() method in this, but no.
Some code:
public boolean checkInput(){
for(JTextField content : textFields){
if(trim(content.getText()).equals("")){
return false;
}
}
return true;
}
private String trim(String string){
String s = trim(string);
return s;
}
Why am I getting the StackOverFlowException from this code? I'm
obviously missing something here.