MouseClicked problem....

public void mouseClicked(MouseEvent e){

int i=Integer.parseInt(jTextField1.getText());

if(i<2100){

System.out.println(i);

}

else if(i>2100){

int j=JOptionPane.showConfirmDialog(null,"Please,Enter a vaild YEAR","YEAR NOT VALID !",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);

if(j==0){ //problem is here. 'YES' button

jTextField2.setNextFocusableComponent(jTextField1);

jTextField1.setText("");

}else if(j==1){ //This is working. 'NO' button

System.exit(0);

}

}

}

//here...if i put value 3000 to jTextField1 & clicked the mousebutton in jTextField2 it gives a ConfirmDialog with YES & NO options.According to the code if i click 'YES' it should clear the text in the jTextField1 & it should stay there.(Cursor should be in jTextField1).

But...

when i run this....(i.e when i press YES) it will only clear the text...The cursor is not in the jTextField1.

It is in the jTextField2.

How can i stop the cursor in jTextField1...

(that is jTextField1 is ready to get a new value.)

pls..tell

[1155 byte] By [ugpja] at [2007-10-1 23:37:54]
# 1
well there's a method in text fields to palce the cursor somewhere... just use it
must41a at 2007-7-15 15:27:45 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...