1 package be
.nikiroo
.fanfix
.reader
.ui
;
3 import java
.awt
.BorderLayout
;
8 import javax
.swing
.BorderFactory
;
9 import javax
.swing
.BoxLayout
;
10 import javax
.swing
.ImageIcon
;
11 import javax
.swing
.JLabel
;
12 import javax
.swing
.JPanel
;
13 import javax
.swing
.JTextArea
;
15 import be
.nikiroo
.fanfix
.data
.MetaData
;
16 import be
.nikiroo
.fanfix
.data
.Story
;
17 import be
.nikiroo
.fanfix
.library
.BasicLibrary
;
18 import be
.nikiroo
.fanfix
.reader
.BasicReader
;
21 * A panel displaying properties and other information of a {@link Story}.
25 public class GuiReaderPropertiesPane
extends JPanel
{
26 private static final long serialVersionUID
= 1L;
27 private final int space
= 10;
30 * Create a new {@link GuiReaderPropertiesPane}.
33 * the library to use for the cover image
35 * the meta to describe
37 public GuiReaderPropertiesPane(BasicLibrary lib
, MetaData meta
) {
39 ImageIcon img
= GuiReaderCoverImager
.generateCoverIcon(lib
, meta
);
41 setLayout(new BorderLayout());
44 JPanel mainPanel
= new JPanel(new BorderLayout());
45 JPanel mainPanelKeys
= new JPanel();
46 mainPanelKeys
.setLayout(new BoxLayout(mainPanelKeys
, BoxLayout
.Y_AXIS
));
47 JPanel mainPanelValues
= new JPanel();
48 mainPanelValues
.setLayout(new BoxLayout(mainPanelValues
,
51 mainPanel
.add(mainPanelKeys
, BorderLayout
.WEST
);
52 mainPanel
.add(mainPanelValues
, BorderLayout
.CENTER
);
54 Map
<String
, String
> desc
= BasicReader
.getMetaDesc(meta
);
56 Color trans
= new Color(0, 0, 0, 1);
57 Color base
= mainPanelValues
.getBackground();
58 for (String key
: desc
.keySet()) {
59 JTextArea jKey
= new JTextArea(key
);
60 jKey
.setFont(new Font(jKey
.getFont().getFontName(), Font
.BOLD
, jKey
61 .getFont().getSize()));
62 jKey
.setEditable(false);
63 jKey
.setLineWrap(false);
64 jKey
.setBackground(trans
);
65 mainPanelKeys
.add(jKey
);
67 final JTextArea jValue
= new JTextArea(desc
.get(key
));
68 jValue
.setEditable(false);
69 jValue
.setLineWrap(false);
70 jValue
.setBackground(base
);
71 mainPanelValues
.add(jValue
);
75 JLabel imgLabel
= new JLabel(img
);
76 imgLabel
.setVerticalAlignment(JLabel
.TOP
);
79 mainPanelKeys
.setBorder(BorderFactory
.createEmptyBorder(space
, space
,
81 mainPanelValues
.setBorder(BorderFactory
.createEmptyBorder(space
, space
,
83 imgLabel
.setBorder(BorderFactory
.createEmptyBorder(0, space
, space
, 0));
86 add(imgLabel
, BorderLayout
.WEST
);
87 add(mainPanel
, BorderLayout
.CENTER
);
91 * The invisible border size (multiply by 2 if you need the total width or
94 * @return the invisible border thickness
96 public int getBorderThickness() {