mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 07:17: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,
|
for improved compatibility with IntelliJ platform themes (e.g. for Vuesion,
|
||||||
Spacegray and Material Design Dark themes).
|
Spacegray and Material Design Dark themes).
|
||||||
- Button: Fixed help button styling in IntelliJ platform themes.
|
- Button: Fixed help button styling in IntelliJ platform themes.
|
||||||
|
- ScrollPane: Paint disabled border if view component (e.g. JTextPane) is
|
||||||
|
disabled.
|
||||||
|
|
||||||
|
|
||||||
## 0.20
|
## 0.20
|
||||||
|
|||||||
@@ -95,12 +95,23 @@ public class FlatBorder
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Paint getBorderColor( Component c ) {
|
protected Paint getBorderColor( Component c ) {
|
||||||
boolean enabled = c.isEnabled() && (!(c instanceof JTextComponent) || ((JTextComponent)c).isEditable());
|
return isEnabled( c )
|
||||||
return enabled
|
|
||||||
? (isFocused( c ) ? focusedBorderColor : borderColor)
|
? (isFocused( c ) ? focusedBorderColor : borderColor)
|
||||||
: disabledBorderColor;
|
: 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 ) {
|
protected boolean isFocused( Component c ) {
|
||||||
if( c instanceof JScrollPane ) {
|
if( c instanceof JScrollPane ) {
|
||||||
JViewport viewport = ((JScrollPane)c).getViewport();
|
JViewport viewport = ((JScrollPane)c).getViewport();
|
||||||
|
|||||||
Reference in New Issue
Block a user