@@ -0,0 +1,2591 @@
+/*%0A * pixelle - Graphics algorithmic editor%0A * Copyright (C) 2008-2013 Dave Brosius%0A * %0A * This library is free software; you can redistribute it and/or%0A * modify it under the terms of the GNU Lesser General Public%0A * License as published by the Free Software Foundation; either%0A * version 2.1 of the License, or (at your option) any later version.%0A * %0A * This library is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A * Lesser General Public License for more details.%0A * %0A * You should have received a copy of the GNU Lesser General Public%0A * License along with this library; if not, write to the Free Software%0A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA%0A */%0Apackage com.mebigfatguy.pixelle.actions;%0A%0Aimport java.awt.Image;%0Aimport java.awt.Rectangle;%0Aimport java.awt.Toolkit;%0Aimport java.awt.datatransfer.Clipboard;%0Aimport java.awt.datatransfer.DataFlavor;%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.image.BufferedImage;%0A%0Aimport javax.swing.AbstractAction;%0Aimport javax.swing.Action;%0Aimport javax.swing.JOptionPane;%0Aimport javax.swing.KeyStroke;%0A%0Aimport com.mebigfatguy.pixelle.FrameMgr;%0Aimport com.mebigfatguy.pixelle.PixelleBundle;%0Aimport com.mebigfatguy.pixelle.PixelleFrame;%0Aimport com.mebigfatguy.pixelle.PixelleImage;%0Aimport com.mebigfatguy.pixelle.utils.GuiUtils;%0A%0Apublic class ClipboardImportAction extends AbstractAction %7B%0A%0A    private static final long serialVersionUID = -357508741723961505L;%0A    PixelleFrame frame;%0A    %0A    public ClipboardImportAction(PixelleFrame pf) %7B%0A        super(PixelleBundle.getString(PixelleBundle.CLIPBOARD_IMPORT_ITEM));%0A        putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('I', ActionEvent.CTRL_MASK));%0A        frame = pf;%0A    %7D%0A    %0A    public void actionPerformed(ActionEvent e) %7B%0A        try %7B%0A            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();%0A            Image imageContents = (Image)clipboard.getData(DataFlavor.imageFlavor);%0A            PixelleFrame pf = new PixelleFrame(new PixelleImage((BufferedImage) imageContents));%0A            Rectangle bounds = GuiUtils.getScreenBounds();%0A            bounds.grow(-200, -200);%0A            pf.setBounds(bounds);%0A            pf.setVisible(true);%0A            FrameMgr.getInstance().add(pf);%0A        %7D catch (Exception ex) %7B%0A            JOptionPane.showMessageDialog(frame, ex.getClass().getSimpleName() + %22 %22 + ex.getMessage());%0A            ex.printStackTrace();%0A        %7D%0A    %7D%0A%7D%0A

add clipboard import action