From d7afe6b44f73215b32236c79e0467a5f65cddcc2 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Thu, 22 Jul 2021 05:06:39 +0100 Subject: [PATCH] Experiment with JSplitPane --- .../java/me/goudham/view/ClipboardView.form | 84 ++++++++++++++++--- .../java/me/goudham/view/ClipboardView.java | 13 ++- 2 files changed, 82 insertions(+), 15 deletions(-) diff --git a/src/main/java/me/goudham/view/ClipboardView.form b/src/main/java/me/goudham/view/ClipboardView.form index ab83015..ced281f 100644 --- a/src/main/java/me/goudham/view/ClipboardView.form +++ b/src/main/java/me/goudham/view/ClipboardView.form @@ -26,7 +26,7 @@ - + @@ -59,8 +59,8 @@ - - + + @@ -103,8 +103,8 @@ - - + + @@ -114,8 +114,8 @@ - - + + @@ -126,8 +126,8 @@ - - + + @@ -162,8 +162,8 @@ - - + + @@ -185,6 +185,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/me/goudham/view/ClipboardView.java b/src/main/java/me/goudham/view/ClipboardView.java index 64fc7c0..8b0cb38 100644 --- a/src/main/java/me/goudham/view/ClipboardView.java +++ b/src/main/java/me/goudham/view/ClipboardView.java @@ -33,6 +33,8 @@ public class ClipboardView implements ClipboardEvent { private JPanel imageButtonPanel; private JButton toggleImageButton; private JScrollPane anotherImagePanel; + private JList list1; + private JLabel yetAnotherImageIcon; private boolean toggle = true; private BufferedImage storedImageContent; @@ -43,21 +45,23 @@ public class ClipboardView implements ClipboardEvent { buttonPane.setBorder(BorderFactory.createEmptyBorder()); listModel = new DefaultListModel<>(); clipboardContentList.setModel(listModel); + list1.setModel(listModel); toggleImageButton.addActionListener(actionEvent -> { if (toggle) { - imageIconLabel.setIcon(null); -// anotherImagePanel.setPreferredSize(new Dimension(0, 0)); + yetAnotherImageIcon.setIcon(null); +// anotherImagePanel.setPreferredSize(null); // anotherImagePanel.setVisible(false); // imageIconLabel.setMaximumSize(new Dimension(0, 0)); // anotherImagePanel.setPreferredSize(new Dimension(0, 0)); toggle = false; } else { // anotherImagePanel.setPreferredSize(new Dimension(300, 300)); - imageIconLabel.setIcon(new ImageIcon(storedImageContent)); // anotherImagePanel.setVisible(true); + yetAnotherImageIcon.setIcon(new ImageIcon(storedImageContent)); toggle = true; } +// anotherImagePanel.revalidate(); }); // final java.awt.datatransfer.clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); @@ -130,7 +134,8 @@ public class ClipboardView implements ClipboardEvent { @Override public void onCopyImage(BufferedImage imageContent) { storedImageContent = imageContent; - imageIconLabel.setIcon(new ImageIcon(imageContent)); +// anotherImagePanel.setMinimumSize(new Dimension(300, 300)); + yetAnotherImageIcon.setIcon(new ImageIcon(imageContent)); toggle = true; // // if (imageContent.getWidth() > 1000 || imageContent.getHeight() > 1000) {