From: Niki Roo Date: Tue, 16 Apr 2019 16:53:03 +0000 (+0200) Subject: GUI: reader group disabled colour X-Git-Tag: fanfix-swing-0.0.1~12^2~137 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=ed8cda22e3c10ae5a9de890547d39bb143f44983;p=fanfix-swing.git GUI: reader group disabled colour --- 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); + } + } }