importer item: re-add overlay percentage complete
authorNiki Roo <niki@nikiroo.be>
Tue, 5 May 2020 20:38:31 +0000 (22:38 +0200)
committerNiki Roo <niki@nikiroo.be>
Tue, 5 May 2020 20:38:31 +0000 (22:38 +0200)
src/be/nikiroo/fanfix_swing/gui/importer/ImporterItem.java

index e18b2596d8ce1773308bc3833abc9ae6092313bf..3367ee04ba4e9a52f43bcce354a5bee9b94d17d7 100644 (file)
@@ -3,6 +3,8 @@ package be.nikiroo.fanfix_swing.gui.importer;
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
@@ -251,4 +253,17 @@ public class ImporterItem extends ListenerPanel implements Hoverable {
                        }
                });
        }
+
+       @Override
+       public void paint(Graphics g) {
+               // Overlay up to x% completed
+               Rectangle clip = g.getClipBounds();
+               if (!(clip == null || clip.getWidth() <= 0 || clip.getHeight() <= 0)) {
+                       g.setColor(new Color(200, 200, 255, 128));
+                       g.fillRect(clip.x, clip.y, (int) Math.round(clip.width * progress),
+                                       clip.height);
+               }
+
+               super.paint(g);
+       }
 }
\ No newline at end of file