mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-23 03:19:06 +00:00
Fix copy to clipboard on Mac.
The previous code `Toolkit.getDefaultToolkit().createImage()` does not read the image file into memory but Clipboard.setContents() on Mac seems to need an image that is already in memory.
This commit is contained in:
parent
ce95fff0fa
commit
9e7db1ce64
@ -388,10 +388,14 @@ class ImageWindow extends JFrame {
|
||||
if (generatedImage == null) {
|
||||
return;
|
||||
}
|
||||
final File png = generatedImage.getPngFile();
|
||||
final Image image = Toolkit.getDefaultToolkit().createImage(png.getAbsolutePath());
|
||||
final ImageSelection imgSel = new ImageSelection(image);
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(imgSel, null);
|
||||
try {
|
||||
final File png = generatedImage.getPngFile();
|
||||
final Image image = ImageIO.read(png);
|
||||
final ImageSelection imgSel = new ImageSelection(image);
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(imgSel, null);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public SimpleLine getSimpleLine() {
|
||||
|
Loading…
Reference in New Issue
Block a user