duplicate matlab command window to gui

☆樱花仙子☆ 提交于 2019-12-25 09:17:49

问题


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.

来源:https://stackoverflow.com/questions/38478641/duplicate-matlab-command-window-to-gui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!