1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-01-10 21:38:04 -05:00

Make preview and status labels clickable and copy label text to clipboard on click (useful for debugging and reporting issues)

This commit is contained in:
Reinhard Pointner 2017-07-03 11:13:28 +08:00
parent f4a532f27b
commit 5c7a6af77f

View File

@ -11,6 +11,7 @@ import static net.filebot.util.ui.SwingUI.*;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -239,6 +240,20 @@ public class FormatDialog extends JDialog {
pane.add(header, "h 60px, growx, dock north"); pane.add(header, "h 60px, growx, dock north");
pane.add(content, "grow"); pane.add(content, "grow");
// copy text to clipboard when clicked
preview.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
preview.addMouseListener(mouseClicked(evt -> {
copyToClipboard(preview.getText());
log.info("Format value has been copied to clipboard");
}));
status.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
status.addMouseListener(mouseClicked(evt -> {
copyToClipboard(status.getText());
log.info("Error message has been copied to clipboard");
}));
// update preview if sample has changed
addPropertyChangeListener("sample", evt -> { addPropertyChangeListener("sample", evt -> {
if (isMacSandbox()) { if (isMacSandbox()) {
if (sample != null && sample.getFileObject() != null && sample.getFileObject().exists()) { if (sample != null && sample.getFileObject() != null && sample.getFileObject().exists()) {