diff --git a/design/page_first.svg b/design/page_first.svg
new file mode 100644
index 0000000..08f9b38
--- /dev/null
+++ b/design/page_first.svg
@@ -0,0 +1,80 @@
+
+
+
+
diff --git a/design/page_last.svg b/design/page_last.svg
new file mode 100644
index 0000000..77f07c1
--- /dev/null
+++ b/design/page_last.svg
@@ -0,0 +1,80 @@
+
+
+
+
diff --git a/design/page_left.svg b/design/page_left.svg
new file mode 100644
index 0000000..1f960f2
--- /dev/null
+++ b/design/page_left.svg
@@ -0,0 +1,71 @@
+
+
+
+
diff --git a/design/page_right.svg b/design/page_right.svg
new file mode 100644
index 0000000..c29b18f
--- /dev/null
+++ b/design/page_right.svg
@@ -0,0 +1,71 @@
+
+
+
+
diff --git a/src/main/java/nl/andrewlalis/blockbookbinder/util/IconLoader.java b/src/main/java/nl/andrewlalis/blockbookbinder/util/IconLoader.java
new file mode 100644
index 0000000..1d66e21
--- /dev/null
+++ b/src/main/java/nl/andrewlalis/blockbookbinder/util/IconLoader.java
@@ -0,0 +1,24 @@
+package nl.andrewlalis.blockbookbinder.util;
+
+import javax.imageio.ImageIO;
+import javax.swing.*;
+import java.awt.*;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class IconLoader {
+
+ public static Icon load(String resourceName, int width, int height) {
+ try {
+ InputStream is = IconLoader.class.getClassLoader().getResourceAsStream(resourceName);
+ if (is == null) {
+ throw new IOException("Could not open resource: " + resourceName);
+ }
+ Image img = ImageIO.read(is).getScaledInstance(width, height, Image.SCALE_SMOOTH);
+ return new ImageIcon(img);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/nl/andrewlalis/blockbookbinder/view/book/BookPreviewPanel.java b/src/main/java/nl/andrewlalis/blockbookbinder/view/book/BookPreviewPanel.java
index f7b5299..4165afb 100644
--- a/src/main/java/nl/andrewlalis/blockbookbinder/view/book/BookPreviewPanel.java
+++ b/src/main/java/nl/andrewlalis/blockbookbinder/view/book/BookPreviewPanel.java
@@ -3,6 +3,7 @@ package nl.andrewlalis.blockbookbinder.view.book;
import lombok.Getter;
import nl.andrewlalis.blockbookbinder.model.Book;
import nl.andrewlalis.blockbookbinder.model.BookPage;
+import nl.andrewlalis.blockbookbinder.util.IconLoader;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
@@ -50,13 +51,15 @@ public class BookPreviewPanel extends JPanel {
this.add(previewPageScrollPane, BorderLayout.CENTER);
JPanel previewButtonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
- this.firstPageButton = new JButton("First");
+ this.firstPageButton = new JButton();
+ this.firstPageButton.setIcon(IconLoader.load("images/page_first.png", 16, 16));
this.firstPageButton.addActionListener(e -> {
this.currentPage = 0;
displayCurrentPage();
});
- this.previousPageButton = new JButton("Previous Page");
+ this.previousPageButton = new JButton();
+ this.previousPageButton.setIcon(IconLoader.load("images/page_left.png", 16, 16));
this.previousPageButton.addActionListener(e -> {
if (currentPage > 0) {
currentPage--;
@@ -64,15 +67,16 @@ public class BookPreviewPanel extends JPanel {
}
});
- this.nextPageButton = new JButton("Next Page");
+ this.nextPageButton = new JButton();
+ this.nextPageButton.setIcon(IconLoader.load("images/page_right.png", 16, 16));
this.nextPageButton.addActionListener(e -> {
if (currentPage < book.getPageCount() - 1) {
currentPage++;
displayCurrentPage();
}
});
-
- this.lastPageButton = new JButton("Last");
+ this.lastPageButton = new JButton();
+ this.lastPageButton.setIcon(IconLoader.load("images/page_last.png", 16, 16));
this.lastPageButton.addActionListener(e -> {
this.currentPage = Math.max(this.book.getPageCount() - 1, 0);
displayCurrentPage();
diff --git a/src/main/resources/images/page_first.png b/src/main/resources/images/page_first.png
new file mode 100644
index 0000000..ad59c50
Binary files /dev/null and b/src/main/resources/images/page_first.png differ
diff --git a/src/main/resources/images/page_last.png b/src/main/resources/images/page_last.png
new file mode 100644
index 0000000..3314da7
Binary files /dev/null and b/src/main/resources/images/page_last.png differ
diff --git a/src/main/resources/images/page_left.png b/src/main/resources/images/page_left.png
new file mode 100644
index 0000000..ca73e66
Binary files /dev/null and b/src/main/resources/images/page_left.png differ
diff --git a/src/main/resources/images/page_right.png b/src/main/resources/images/page_right.png
new file mode 100644
index 0000000..7ab29fa
Binary files /dev/null and b/src/main/resources/images/page_right.png differ