Hi,
Anybody know what exactly means by IllegalArgumentAcception? In my program the error message print out like this:
java.lang.IllegalArgumentException: bad position: 1 at javax.swing.text.JTextComponent.setCaretPosition(JTextComponent.java:1650)
From my coding:
try
{
String val = "A";
int pos = getCaretPosition();
getDocument().insertString(getCaretPosition(),val,null);
setCaretPosition(pos+1);
moveCaretPosition(pos+1);
requestFocusInWindow();
}catch(Exception input)
{ input.printStackTrace(); }
It seems that the
setCaretPosition(pos+1)
in my coding facing problem. But I sure that the coding correct. Is there something out of my sight or something I incorrectly put in there. I need opinion on this matter. Can anybody help?
thanks