mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
ScrollPane: paint disabled border if view component (e.g. JTextPane) is disabled
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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