return generateCoverIcon(lib, GuiReaderBookInfo.fromMeta(meta));
}
+ /**
+ * The width of a cover image.
+ *
+ * @return the width
+ */
+ static public int getCoverWidth() {
+ return SPINE_WIDTH + COVER_WIDTH;
+ }
+
+ /**
+ * The height of a cover image.
+ *
+ * @return the height
+ */
+ static public int getCoverHeight() {
+ return COVER_HEIGHT + HOFFSET;
+ }
+
/**
* Generate a cover icon based upon the given {@link GuiReaderBookInfo}.
*
if (resizedImage == null) {
try {
Image cover = info.getBaseImage(lib);
- resizedImage = new BufferedImage(SPINE_WIDTH + COVER_WIDTH,
- SPINE_HEIGHT + COVER_HEIGHT + HOFFSET,
- BufferedImage.TYPE_4BYTE_ABGR);
+ resizedImage = new BufferedImage(getCoverWidth(),
+ getCoverHeight(), BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g = resizedImage.createGraphics();
try {
* up/down one line at a time.
*/
private void computeItemsPerLine() {
- // TODO
- itemsPerLine = 5;
+ itemsPerLine = 1;
+
+ if (books != null && books.size() > 0) {
+ // this.pane holds all the books with a hgap of 5 px
+ int wbook = books.get(0).getWidth() + 5;
+ itemsPerLine = pane.getWidth() / wbook;
+ }
}
/**
pane.repaint();
validate();
repaint();
+
+ computeItemsPerLine();
}
/**