Giter Site home page Giter Site logo

Ctrl+C Ctrl+V about dskmanager HOT 3 CLOSED

renaudhelias avatar renaudhelias commented on July 26, 2024
Ctrl+C Ctrl+V

from dskmanager.

Comments (3)

renaudhelias avatar renaudhelias commented on July 26, 2024

`/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package jemu.ui.paint;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.image.BufferedImage;
import java.io.IOException;

/**
*

  • @author Markus
    */
    public class ImageFromClipboard {

    public Image getImageFromClipboard() {
    Transferable transferable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
    if (transferable != null && transferable.isDataFlavorSupported(DataFlavor.imageFlavor)) {
    try {
    return (Image) transferable.getTransferData(DataFlavor.imageFlavor);
    } catch (UnsupportedFlavorException e) {
    // handle this as desired
    e.printStackTrace();
    } catch (IOException e) {
    // handle this as desired
    e.printStackTrace();
    }
    }
    return null;
    }

    public BufferedImage getBufferedImageFromClipboard() {
    Image clip = getImageFromClipboard();
    if (clip == null) {
    return null;
    }
    BufferedImage buffclip = new BufferedImage(clip.getWidth(null), clip.getHeight(null), BufferedImage.TYPE_INT_ARGB);
    Graphics g = buffclip.createGraphics();
    g.drawImage(clip, 0, 0, null);
    return buffclip;
    }
    }
    `

from dskmanager.

renaudhelias avatar renaudhelias commented on July 26, 2024

File to Desktop.

from dskmanager.

renaudhelias avatar renaudhelias commented on July 26, 2024

Done

from dskmanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.