From d9c9cce1940dbaacdb6cd948b42ace64a2334488 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 27 Aug 2019 12:45:16 +0200 Subject: [PATCH] TextArea: fixed background if explicit color is set --- .../java/com/formdev/flatlaf/ui/FlatTextAreaUI.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextAreaUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextAreaUI.java index f649520f..61cbf929 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextAreaUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextAreaUI.java @@ -21,6 +21,7 @@ import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.UIResource; import javax.swing.plaf.basic.BasicTextAreaUI; import javax.swing.text.JTextComponent; @@ -56,9 +57,12 @@ public class FlatTextAreaUI protected void paintBackground( Graphics g ) { JTextComponent c = getComponent(); - g.setColor( !c.isEnabled() - ? disabledBackground - : (!c.isEditable() ? inactiveBackground : c.getBackground()) ); + Color background = c.getBackground(); + g.setColor( !(background instanceof UIResource) + ? background + : (!c.isEnabled() + ? disabledBackground + : (!c.isEditable() ? inactiveBackground : background)) ); g.fillRect( 0, 0, c.getWidth(), c.getHeight() ); } }