From 6bf49e68d2e9316c61eae630d00e715fbc4940c8 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 8 Apr 2020 23:45:29 +0200 Subject: [PATCH] improve cached icon --- .../gui/book/BookCoverImager.java | 7 +++---- .../fanfix_swing/gui/book/BookLine.java | 20 ++++++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/be/nikiroo/fanfix_swing/gui/book/BookCoverImager.java b/src/be/nikiroo/fanfix_swing/gui/book/BookCoverImager.java index 84a4f944..8bdcfabf 100644 --- a/src/be/nikiroo/fanfix_swing/gui/book/BookCoverImager.java +++ b/src/be/nikiroo/fanfix_swing/gui/book/BookCoverImager.java @@ -39,7 +39,8 @@ class BookCoverImager { static final Color SPINE_COLOR_RIGHT = new Color(100, 100, 100); static final Color BORDER = Color.black; - public static final Color UNCACHED_ICON_COLOR = new Color(0, 80, 220); + public static final Color UNCACHED_ICON_COLOR = Color.green.darker(); + // new Color(0, 80, 220); public static final int TEXT_HEIGHT = 50; public static final int TEXT_WIDTH = COVER_WIDTH + 40; @@ -106,9 +107,7 @@ class BookCoverImager { g.setColor(color); g.fillRect(clip.x, clip.y, clip.width, clip.height); - if (!cached) { - UIUtils.drawEllipse3D(g, UNCACHED_ICON_COLOR, COVER_WIDTH + HOFFSET + 30, 10, 20, 20); - } + UIUtils.drawEllipse3D(g, UNCACHED_ICON_COLOR, COVER_WIDTH + HOFFSET + 30, 10, 20, 20, cached); } /** diff --git a/src/be/nikiroo/fanfix_swing/gui/book/BookLine.java b/src/be/nikiroo/fanfix_swing/gui/book/BookLine.java index b4c6be41..beb4c973 100644 --- a/src/be/nikiroo/fanfix_swing/gui/book/BookLine.java +++ b/src/be/nikiroo/fanfix_swing/gui/book/BookLine.java @@ -2,11 +2,11 @@ package be.nikiroo.fanfix_swing.gui.book; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.SwingConstants; import be.nikiroo.fanfix.data.Story; import be.nikiroo.fanfix_swing.gui.BooksPanel; @@ -52,19 +52,29 @@ public class BookLine extends JPanel { * Initialise this {@link BookLine}. */ protected void init() { - // TODO: image? - iconCached = new JLabel(" "); - iconNotCached = new JLabel(" * "); + iconCached = new JLabel(" ◉ "); + iconNotCached = new JLabel(" ○ "); iconNotCached.setForeground(BookCoverImager.UNCACHED_ICON_COLOR); + iconCached.setForeground(BookCoverImager.UNCACHED_ICON_COLOR); iconCached.setPreferredSize(iconNotCached.getPreferredSize()); title = new JLabel(); secondary = new JLabel(); secondary.setForeground(AUTHOR_COLOR); + JLabel id = new JLabel(info.getMeta().getLuid()); + id.setPreferredSize(new JLabel(" 999 ").getPreferredSize()); + id.setForeground(Color.gray); + id.setHorizontalAlignment(SwingConstants.CENTER); + + JPanel idTitle = new JPanel(new BorderLayout()); + idTitle.setOpaque(false); + idTitle.add(id, BorderLayout.WEST); + idTitle.add(title, BorderLayout.CENTER); + setLayout(new BorderLayout()); - add(title, BorderLayout.CENTER); + add(idTitle, BorderLayout.CENTER); add(secondary, BorderLayout.EAST); updateMeta(); -- 2.27.0