我正在尝试将代码作为可单击的快捷方式导出,该快捷方式在单击按钮时调用Arduino代码。但是,我遇到了很多错误,我不确定为什么。我已经插入了Arudino,它运行并执行该操作,没有任何错误。但是出口时,它行不通。有人有主意吗?
附带问题:我还试图更改.setlabel的字体。我想访问更多的字体,但是似乎只有某些字体可以更改为新罗马黑色和Arial Black。但是,例如,当我将其更改为Verdana时,它会给我默认处理字体。我可以导入库以获取更多字体吗?我见过一些人在使用Verdana,但我不确定如何使用。
如果我应该分享其他任何信息,请告诉我!
这些是我遇到的错误:
\`\[0\] "COM3"
\[1\] "COM5"
\[2\] "COM6"
\[3\] "COM13"
ControlP5 2.2.6 infos, comments, questions at http://www.sojamo.de/libraries/controlP5
java.lang.NullPointerException: Cannot invoke "String.split(String)" because the return value of "processing.app.Preferences.get(String)" is null
at processing.mode.java.JavaBuild.exportApplication(JavaBuild.java:584)
at processing.mode.java.JavaMode.handleExportApplication(JavaMode.java:187)
at processing.mode.java.ExportPrompt.trigger(ExportPrompt.java:494)
at processing.mode.java.ExportPrompt.trigger(ExportPrompt.java:156)
at processing.mode.java.JavaEditor.handleExportApplication(JavaEditor.java:516)
at processing.mode.java.JavaEditor.lambda$buildFileMenu$0(JavaEditor.java:239)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1028)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
at java.desktop/java.awt.Component.processEvent(Component.java:6391)
at java.desktop/java.awt.Container.processEvent(Container.java:2266)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)\`
I have 2 versions. My first version did not contain string.split, but still gave me the error
java.lang.NullPointerException: Cannot invoke "String.split(String)" because the return value of "processing.app.Preferences.get(String)" is null
我不确定该怎么做。谢谢您阅读此书
I am trying to export my code as a clickable shortcut that calls Arduino code when a button is clicked. However, I ran into a bunch of errors and I am not sure why. I have plugged my Arudino and it runs and does what it is supposed to without any errors. But when exporting, it doesn't work. Does anyone have an idea?
Side question: I am also trying to change the font of the .setLabel. I want to access more fonts, but it seems like there are only certain fonts I can change into and it works like Times New Roman and Arial Black. But for example, when I change it into Verdana, it gives me the default processing font. Is there a library I can import to get more fonts? I have seen some people using Verdana but I am not sure how.
If there are any other information I should share please let me know!
These are snips of the errors I ran into:
\`\[0\] "COM3"
\[1\] "COM5"
\[2\] "COM6"
\[3\] "COM13"
ControlP5 2.2.6 infos, comments, questions at http://www.sojamo.de/libraries/controlP5
java.lang.NullPointerException: Cannot invoke "String.split(String)" because the return value of "processing.app.Preferences.get(String)" is null
at processing.mode.java.JavaBuild.exportApplication(JavaBuild.java:584)
at processing.mode.java.JavaMode.handleExportApplication(JavaMode.java:187)
at processing.mode.java.ExportPrompt.trigger(ExportPrompt.java:494)
at processing.mode.java.ExportPrompt.trigger(ExportPrompt.java:156)
at processing.mode.java.JavaEditor.handleExportApplication(JavaEditor.java:516)
at processing.mode.java.JavaEditor.lambda$buildFileMenu$0(JavaEditor.java:239)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1028)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
at java.desktop/java.awt.Component.processEvent(Component.java:6391)
at java.desktop/java.awt.Container.processEvent(Container.java:2266)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)\`
I have 2 versions. My first version did not contain string.split, but still gave me the error
java.lang.NullPointerException: Cannot invoke "String.split(String)" because the return value of "processing.app.Preferences.get(String)" is null
I am not sure what to do. Thank you for reading this
发布评论
评论(1)
不幸的是,我将无法详细回答。
似乎有错误导出EXE(导出时获得偏好)。
(您应该发布您正在使用的处理版本以及哪个Windows版本的情况,以防其他版本有相同的问题,也许是解决方案。)
我的直觉是这是以后的版本。作为解决方法,尝试从较旧版本的处理(例如3.4)导出。
关于字体,请查看:
loadfont(
pfont
,尝试示例(也可以通过处理>示例>贡献库> controlp5> use gt; controlp5controft )Unfortunately I won't be able to answer in great detail.
It looks like there's an error exporting the exe (getting preferences while exporting).
(You should post which version of Processing you're using and which Windows version just in case other have the same issue and maybe a fix.)
My hunch is this is a later version. As a workaround try exporting from an older version of Processing (e.g. 3.4).
Regarding the font, have a look at:
loadFont()
PFont
, try the ControlP5controlFont example (also accessible via Processing > Examples > Contributed Libraries > ControlP5 > use > ControlP5controlFont)