We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello! I have made a program, that has a thread once in 2 seconds writing 5(or more) lines to G4P textarea. To be able to look through those lines I added scrollbars, but when I start to scroll my program gives error:
java.lang.NullPointerException at g4p_controls.StyledString.getLines(Unknown Source) at g4p_controls.GTextArea.appendText(Unknown Source) at CanDecoder.UARTread(CanDecoder.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at processing.core.PApplet.method(PApplet.java:4167) at processing.core.PApplet$4.run(PApplet.java:4197)
If I move the scrollbar up among writings it crashes with the same error when it comes time to write lines and textarea tries to move cursor to the last line. Any ideas how to fix this? Maybe there is a possibility to stop autoscroll? There is a method to move cursor to the end of text in G4P API(moveCaretEndOfText (TextLayoutHitInfo currPos)), but it requires something I don't understand.
I also had an error writing 5 lines, but it was solved when I added 100ms delay between writings
Thanks in advance Best regards, Paul