0

I am asking this question in reference to this post as I wasn't able to comment to the original post.

I used the code given in that post from @Hoki and mixed in my gui it is working fine. But sometimes i am getting following error

Error using test_gui>scroll_to_bottom (line 176)                                       
Java exception occurred:                                                                  
java.lang.IllegalArgumentException: bad position: 13319                                   

at javax.swing.text.JTextComponent.setCaretPosition(Unknown Source)                      


Error in test_gui>commandWindowMirror (line 170)                                       
scroll_to_bottom(h.f)                                                                 

Error using test_gui>commandWindowMirror (line 166)                                    
Java exception occurred:                                                                  
javax.swing.text.BadLocationException: Invalid location                                   

at javax.swing.text.GapContent.getChars(Unknown Source)                                  

at javax.swing.text.GapContent.getString(Unknown Source)                                 

at javax.swing.text.AbstractDocument.getText(Unknown Source)                             

at javax.swing.text.JTextComponent.getText(Unknown Source)   

This always happens when I ask user to input something. My script ask users to enter some strings or values sometimes. But good thing is program doesnot crash it gives just error and when you press 'enter' again it returns to back position where it was stop. but scroll stops working and only when script is executed fully scroll comes to the last line. Any idea what might be causing this error and how to avoid it. Thank you.

Community
  • 1
  • 1
Ahsan
  • 15
  • 4
  • @Hoki any suggestions ? – Ahsan Jul 20 '16 at 13:00
  • Please try to write your question in a way that people can easily see what they need without clicking links. It is good to reference, but it is recommended to put the relevant part of the question in here. (Consider confusion that may rise if the other question would get edited, or moved). -- Another note: I have linked to this question from the original question so people may find it more easily. – Dennis Jaheruddin Jul 20 '16 at 13:07
  • @DennisJaheruddin thank you and I will keep these things in mind. – Ahsan Jul 20 '16 at 13:15
  • you should provide a MWE to illustrate the situation... – scmg Jul 20 '16 at 13:55

0 Answers0