Java 处理 ControlP5 意外导出错误

发布于 2025-01-18 03:06:14 字数 2767 浏览 4 评论 0 原文

我正在尝试将代码作为可单击的快捷方式导出,该快捷方式在单击按钮时调用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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一瞬间的火花 2025-01-25 03:06:14

不幸的是,我将无法详细回答。

似乎有错误导出EXE(导出时获得偏好)。

(您应该发布您正在使用的处理版本以及哪个Windows版本的情况,以防其他版本有相同的问题,也许是解决方案。)

我的直觉是这是以后的版本。作为解决方法,尝试从较旧版本的处理(例如3.4)导出。

关于字体,请查看:

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:

  • Processing > Tools > Create Font
  • loadFont()
  • once everything works as expected with loading a PFont, try the ControlP5controlFont example (also accessible via Processing > Examples > Contributed Libraries > ControlP5 > use > ControlP5controlFont)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文