diff --git a/CHANGELOG.md b/CHANGELOG.md index e92fa2a8..3ca520de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ FlatLaf Change Log for improved compatibility with IntelliJ platform themes (e.g. for Vuesion, Spacegray and Material Design Dark themes). - Button: Fixed help button styling in IntelliJ platform themes. +- ScrollPane: Paint disabled border if view component (e.g. JTextPane) is + disabled. ## 0.20 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java index 482d928a..f6b5c4c8 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java @@ -95,12 +95,23 @@ public class FlatBorder } protected Paint getBorderColor( Component c ) { - boolean enabled = c.isEnabled() && (!(c instanceof JTextComponent) || ((JTextComponent)c).isEditable()); - return enabled + return isEnabled( c ) ? (isFocused( c ) ? focusedBorderColor : borderColor) : disabledBorderColor; } + protected boolean isEnabled( Component c ) { + if( c instanceof JScrollPane ) { + // check whether view component is disabled + JViewport viewport = ((JScrollPane)c).getViewport(); + Component view = (viewport != null) ? viewport.getView() : null; + if( view != null && !isEnabled( view ) ) + return false; + } + + return c.isEnabled() && (!(c instanceof JTextComponent) || ((JTextComponent)c).isEditable()); + } + protected boolean isFocused( Component c ) { if( c instanceof JScrollPane ) { JViewport viewport = ((JScrollPane)c).getViewport();