On Mon, 3 Nov 2025 04:53:24 GMT, Prasanta Sadhukhan <[email protected]> wrote:
>> src/java.desktop/share/classes/javax/swing/BorderFactory.java line 147: >> >>> 145: * the highlight color. The inner edge of the shadow area >>> 146: * uses a brighter shade of the shadow color. >>> 147: * If highlight and shadow color are null, then it will >> >> The text above says that if both are null it will fall back. You don't mean >> that. >> You mean if either is null it will fall back. >> >> This results in the colors all being null. >> >> And I think you need to look further. >> The NPE happens because BevelBorder does this >> this(bevelType, highlight.brighter(), highlight, shadow, >> shadow.brighter()); >> >> But the constructor it is calling is also public and will happily allow >> nulls for any specific case. >> So perhaps the above constructor should be doing something like >> ((highlight != null) ? highlight.brighter : null) > > Yes, it seems handling the NPE in BevelBorder is more apt..I have updated the > PR removing from BorderFactory and updated BevelBorder to handle null > hinghlighter and shadow BevelBorder handles null color too as seen here so we can do as suggested https://github.com/openjdk/jdk/blob/4cfabd605c42494db4ca4078344d32abc951a9ae/src/java.desktop/share/classes/javax/swing/border/BevelBorder.java#L163-L166 https://github.com/openjdk/jdk/blob/4cfabd605c42494db4ca4078344d32abc951a9ae/src/java.desktop/share/classes/javax/swing/border/BevelBorder.java#L195-L198 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27949#discussion_r2485327587
