具有 Substance 外观和感觉的 JColorChooser,Java 7
我正在编写一个使用 Substance 外观和 JColorChooser 的应用程序。这在 Java 6 中工作得很好,但在尝试使用 Java 7 时,它确实不符合 JColorChooser 的效果:
java.lang.NullPointerException
at org.pushingpixels.substance.internal.ui.SubstanceListUI$SubstanceListSelectionListener$1.run(SubstanceListUI.java:135)
我猜这与 Java 7 中引入的新 JColorChooser 有关,而 Substance 与当前的 JColorChooser 相关。以某种方式。然而,除了编写我自己的颜色选择器之外,还有没有人知道的解决这个问题的好方法?我怀疑(希望)内容会在适当的时候更新以解决这个问题,但我想在 Java 7 发布之前尝试一下 Java 7 早期版本中的一些新功能。
我以某种方式怀疑这个问题的答案是否定的,但如果某处有快速修复/补丁(我找不到),那将会很有用!
I'm writing an application that uses the Substance look and feel along with a JColorChooser. This works fine with Java 6, but on trying things out with Java 7 it really doesn't JColorChooser's:
java.lang.NullPointerException
at org.pushingpixels.substance.internal.ui.SubstanceListUI$SubstanceListSelectionListener$1.run(SubstanceListUI.java:135)
I'm guessing this is to do with the new JColorChooser that's being introduced in Java 7, and that Substance is tied to the current one in some way. However, aside from writing my own colour chooser, is there a nice way round this issue that anyone knows of? I suspect (hope) substance will be updated in due course to solve this issue, but I'd like to play around with some of the new features in the early builds of Java 7 before it's released.
I somehow suspect the answer to this is no, but if there is a quick fix / patch somewhere (I couldn't find one) it would be useful!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是“Bug 兼容性”中一项有趣的研究。如果颜色设置为 null 并且您尝试从颜色选择器获取颜色,则会导致 NullPointerException。 Kirill 预料到了这一点,并将其困在 try/catch 块中。然而,在 Java 7 中,它们从该方法返回 null,而不是抛出 NPE。
大约有三个代码片段需要更改:
https://github.com/Insubstantial/ insubstantial/commit/0f01ae676c6f56d6879862a911ad03caeafabc52
在接下来的一周左右,我将发布我的第一个 insubstantial 发行版,其中将包含此修复程序。
This is an interesting study in "Bug Compatibility." If the color is set to null and you try and get the color from the color chooser, a NullPointerException resulted. Kirill expected this and trapped it in a try/catch block. However, in Java 7 they instead return null from that method instead of throwing an NPE.
There are about three snippets of code that need to be changed:
https://github.com/Insubstantial/insubstantial/commit/0f01ae676c6f56d6879862a911ad03caeafabc52
In the next week or so I'm going to publish my first distribution of insubstantial that will include this fix.