focus related problem
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jayesh_makhwna
Posted On:   Saturday, June 3, 2006 06:05 AM

I have put validations on the textfields using lostFocus events in each textfield, now if i move from one field to other breaking the validation the cursor hangs between the current and next field. in validating if validation is broken then i have again focused using requestFocus on the same textfield. so what can i do ? private void party_noFocusLost(FocusEvent e) { // TODO add your code here String content = party_no.getText(); if(content.length()==0 || content.length() > 8) { getToolkit().beep(); party_no.selectAll(); party_no.grabFocus(); } } private v   More>>

I have put validations on the textfields using
lostFocus events in each textfield,

now if i move from one field to other breaking the validation the cursor hangs between the current and next field.

in validating if validation is broken then i have again focused using requestFocus on the same textfield.

so what can i do ?

			

private void party_noFocusLost(FocusEvent e) {
// TODO add your code here

String content = party_no.getText();
if(content.length()==0 || content.length() > 8)
{
getToolkit().beep();
party_no.selectAll();
party_no.grabFocus();
}



}

private void party_nameFocusLost(FocusEvent e) {
// TODO add your code here

try{
Integer.parseInt(party_name.getText());

getToolkit().beep();
party_name.selectAll();
party_name.grabFocus();

System.out.println("Try");
}

   <<Less
About | Sitemap | Contact