开发者

JColorChooser with Substance look and feel, 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 开发者_如何学Pythonsome 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜