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