From ed8cda22e3c10ae5a9de890547d39bb143f44983 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Tue, 16 Apr 2019 18:53:03 +0200 Subject: [PATCH] GUI: reader group disabled colour --- .../fanfix/reader/ui/GuiReaderGroup.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java index df3b74a0..7b154256 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java @@ -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); + } + } } -- 2.27.0