GUI: reader group disabled colour
authorNiki Roo <niki@nikiroo.be>
Tue, 16 Apr 2019 16:53:03 +0000 (18:53 +0200)
committerNiki Roo <niki@nikiroo.be>
Tue, 16 Apr 2019 16:53:03 +0000 (18:53 +0200)
src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java

index df3b74a0bdaaab9d9da355dd4943f7ba0e94f02f..7b15425682b96e363df67c66d7a87ac7be35da9d 100644 (file)
@@ -3,6 +3,8 @@ package be.nikiroo.fanfix.reader.ui;
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Rectangle;
 import java.awt.event.ActionListener;
 import java.awt.event.ComponentAdapter;
 import java.awt.event.ComponentEvent;
@@ -423,4 +425,19 @@ public class GuiReaderGroup extends JPanel {
                        e.consume();
                }
        }
+
+       @Override
+       public void paint(Graphics g) {
+               super.paint(g);
+
+               Rectangle clip = g.getClipBounds();
+               if (clip.getWidth() <= 0 || clip.getHeight() <= 0) {
+                       return;
+               }
+
+               if (!isEnabled()) {
+                       g.setColor(new Color(128, 128, 128, 128));
+                       g.fillRect(clip.x, clip.y, clip.width, clip.height);
+               }
+       }
 }