I have this code :
private void submitPstart() {
if (tStock.getText().charAt(0)>='A' && tStock.getText().charAt(0)<='Z'){
}else {
errorBox ("Uppercase A-Z");
}
tStock.setText("");
tStock.setFocus();
}
THis is working but when I try not to put anything on the textbox and press the OK button it crashes. It says:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
and it pointed out to this part: if (tStock.getText().charAt(0)>='A' && tStock.getText().charAt(0)<='Z')
Any help is appreciated. Thanks