Is ControlP5 compatible with FX2D?

Hello,

I recently changed my sketch's renderer to FX2D for more performance but now, controlP5 seems to be firing some exceptions that prevents my sketch from running. As far as I know, it seems to be somewhat related to font loading or something. Here's the stack trace:

java.lang.NullPointerException at processing.javafx.PGraphicsFX2D$FontCache$Key.hashCode(PGraphicsFX2D.java:1423) at java.util.HashMap.hash(HashMap.java:338) at java.util.LinkedHashMap.get(LinkedHashMap.java:440) at processing.javafx.PGraphicsFX2D$FontCache.get(PGraphicsFX2D.java:1377) at processing.javafx.PGraphicsFX2D.handleTextFont(PGraphicsFX2D.java:1470) at processing.javafx.PGraphicsFX2D.textFontImpl(PGraphicsFX2D.java:1446) at processing.core.PGraphics.textFont(PGraphics.java:4232) at controlP5.ControlFont.adjust(Unknown Source) at controlP5.Label$SinglelineLabel.draw(Unknown Source) at controlP5.Label$SinglelineLabel.draw(Unknown Source) at controlP5.Label.draw(Unknown Source) at controlP5.Textfield.draw(Unknown Source) at controlP5.ControllerGroup.drawControllers(Unknown Source) at controlP5.ControllerGroup.draw(Unknown Source) at controlP5.ControlWindow.draw(Unknown Source) at controlP5.ControlWindow.draw(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1395) at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1388) at processing.core.PApplet.handleMethods(PApplet.java:1582) at processing.core.PApplet.handleDraw(PApplet.java:2412) at processing.javafx.PSurfaceFX$1.handle(PSurfaceFX.java:75) at processing.javafx.PSurfaceFX$1.handle(PSurfaceFX.java:1) at com.sun.scenario.animation.shared.TimelineClipCore.visitKeyFrame(TimelineClipCore.java:226) at com.sun.scenario.animation.shared.TimelineClipCore.playTo(TimelineClipCore.java:184) at javafx.animation.Timeline.impl_playTo(Timeline.java:176) at javafx.animation.AnimationAccessorImpl.playTo(AnimationAccessorImpl.java:39) at com.sun.scenario.animation.shared.InfiniteClipEnvelope.timePulse(InfiniteClipEnvelope.java:110) at javafx.animation.Animation.impl_timePulse(Animation.java:1102) at javafx.animation.Animation$1.lambda$timePulse$26(Animation.java:186) at javafx.animation.Animation$1$$Lambda$99/1799217597.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at javafx.animation.Animation$1.timePulse(Animation.java:185) at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344) at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:521) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:505) at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$400(QuantumToolkit.java:334) at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$56/1871729890.run(Unknown Source) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101) at com.sun.glass.ui.win.WinApplication$$Lambda$52/1220204850.run(Unknown Source) at java.lang.Thread.run(Thread.java:745) handleDraw() called before finishing Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help ? Troubleshooting.

My animations lag when I'm not using FX2D and I need ControlP5 for user interface. How can I fix this? Or is it even caused by FX2D?

Answers

  • There is no more exceptions thanks to that workaround. However, in my textfields, all chars appear uppercase even though I'm typing lowercase text..

  • edited June 2016

    I can successfully set lowercase letters with the .setText(String) method, but every letter typed by the user is not only printed in uppercase, but registered as uppercase (.getText() returns an uppercase string).. Special characters (like alt) do not work anymore. It's like shift, caps lock, alt, etc don't get registered correctly.. I really don't want to workaround this by registering the keypresses myself and appending them with .setText() and everything

  • You're gonna have to open an issue there I'm afraid. :-<

  • edited June 2016

    That was me :P Now I only have to wait for Sojamo to answer me :) Thanks for your help and quick replies!

Sign In or Register to comment.