Override new methods and display Image

main
Hammy 3 years ago
parent 9a7fd3eb1e
commit d7e25f8f2d

@ -1,29 +1,35 @@
package me.goudham.view;
import me.goudham.ClipboardListener;
import me.goudham.listener.ClipboardEvent;
import me.goudham.model.MyClipboardContent;
import java.awt.Dimension;
import java.awt.Image;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.Dimension;
import me.goudham.ClipboardListener;
import me.goudham.listener.ClipboardEvent;
public class ClipboardView implements ClipboardEvent {
private JPanel Clipboard;
private JButton copyButton;
private JButton copySelectedTextButton;
private JList<String> clipboardContentList;
private final DefaultListModel<String> listModel;
private JLabel title;
private JScrollPane scrollPane;
private JPanel buttonPane;
private JButton clearButton;
private JButton clearAllHistoryButton;
private JButton removeButton;
private JLabel imageIconLabel;
private JLabel textClipboardLabel;
private JButton copyImageBelowButton;
private JButton removeImageBelowButton;
private JPanel imageButtonPanel;
private JPanel imagePanel;
public ClipboardView() {
scrollPane.setBorder(BorderFactory.createEmptyBorder());
@ -81,15 +87,19 @@ public class ClipboardView implements ClipboardEvent {
jFrame.setVisible(true);
jFrame.setAlwaysOnTop(true);
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setPreferredSize(new Dimension(1000, 680));
jFrame.setMaximumSize(new Dimension(1000, 680));
jFrame.setPreferredSize(new Dimension(1200, 900));
jFrame.setResizable(true);
jFrame.pack();
jFrame.setLocationRelativeTo(null);
}
@Override
public <T> void onCopy(MyClipboardContent<T> copiedContent) {
listModel.add(0, copiedContent.getContent().toString());
public void onCopyString(String stringContent) {
listModel.add(0, stringContent);
}
@Override
public void onCopyImage(Image imageContent) {
imageIconLabel.setIcon(new ImageIcon(new ImageIcon(imageContent).getImage().getScaledInstance(500, 250, Image.SCALE_SMOOTH)));
}
}

Loading…
Cancel
Save