mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
ScrollPane: paint disabled border if view component (e.g. JTextPane) is disabled
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user