Unable to grab jpeg from clipboard

Hi
I am trying to display a jpeg image from a clipboard in my application. However It keeps coming up with Data Flavor Unsupported exception. I have tried even creating a separate DataFlavor object of jpeg, but still its not working. Any help is appreciated.
The code that I am using is :
Graphics g = mainPanel.getGraphics();
        Image img = null;
        //DataFlavor jpegFlavor = new DataFlavor("image/jpeg","JPEG image");
        if (clipboardContents.isDataFlavorSupported(DataFlavor.imageFlavor))
        // get the system clipboard
        Clipboard systemClipboard =
                Toolkit.getDefaultToolkit().getSystemClipboard();
        // get the contents on the clipboard in a
        // Transferable object
        Transferable clipboardContents =
                systemClipboard.getContents(null);
        // check if contents are empty, if so, return null
        if (clipboardContents == null)
            img = null;
        } else
            try
                // make sure content on clipboard is
                // falls under a format supported by the
                // imageFlavor Flavor
                if (clipboardContents.isDataFlavorSupported(DataFlavor.imageFlavor))
                    // convert the Transferable object
                    // to an Image object
                    Image image =
                            (Image) clipboardContents.getTransferData(DataFlavor.imageFlavor);
                    img = image;
            } catch (UnsupportedFlavorException ufe)
                ufe.printStackTrace();
            } catch (IOException ioe)
                ioe.printStackTrace();
        g.drawImage(img, 0, 0, null);Regards.

If I comment out the IF check, then the following exception is displayed.
java.awt.datatransfer.UnsupportedFlavorException
at sun.awt.datatransfer.ClipboardTransferable.getTransferData(ClipboardTransferable.java:143)
at clipboardtesting.ClipboardTestingView.GrabActionPerformed(ClipboardTestingView.java:247)
at clipboardtesting.ClipboardTestingView.access$800(ClipboardTestingView.java:30)
at clipboardtesting.ClipboardTestingView$4.actionPerformed(ClipboardTestingView.java:130)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5806)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4413)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2440)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Similar Messages

  • Unable to transfer photos (jpeg) from desktop to SD card.  Appears as if successful then does not show up when put SD card in camera.

    Unable to transfer photos (jpeg) from desktop to SD card for Cannon Power shot camera. 
    Appears as if successful, jpegs show up in SD card window,  but they do not  show up when I put SD card in camera.
    Go through entire process to no avail.  SD card is not locked.
    Thank You
    L

    Ahh, extra info ahead...
    Pictures on SD card, SanDisc-SDHC, 4GB Card, are jpeg.  The ones I would like to put on the card are jpeg as well.
    SD format MS-DOS (FAT32) .
    3.876 GB available on card.
    I have
    Exported the pics from iPhoto to the desktop. Inserted sd card into side of iMac.  The icon of card popped up.
    Attempts to no avail:
    1)   Dragged the photos to the disk icon for the sd card.
    2)   Dragged pictures into the DCIM folder (where all photos taken on camera resided).
    3)   Created new folder.  Put photos from desktop into folder and dragged ne folder inside DCIM -since pictures taken at different times had their own folders inside the DCIM folder.
    Every time the photos/files end up showing up on the sd card as long as it is in my computer but when ejected and inserted into my camera, all imported photos/jpeg file are gone.
    Hmmmmm

  • Unable to open jpeg in photoshop from Bridge

    Hi
    I recently installed CS5 Production Premium on a Windows 7 computer. I have been unable to open Jpegs by right clicking the mouse. When I get the 'open with' tab, the default states Com Surrogate 6.1.
    I am unable to ascertain how to set Photoshop as the default programme to open JPEG files.
    Any assistance woul be appreciated!
    Regards
    RoeBean

    Default programs (at least in CS3) are in edit/preferences/file type associations.  Scroll down the list to change the default opening program.

  • Unable to see or import jpegs from photo cd

    I am trying to import jpegs from a photo cd prepared by a photo store when having my film processed. The cd is recognised and I can see the folders and the actual jpeg files but cannot view photos or import into iphoto. Is there any way I can access or import these jpegs?
      Mac OS X (10.2.x)  

    Hi, Charlene. You might try copying all the jpegs from the CD into a new folder on your hard drive, and then importing them from that folder into iPhoto. If that's successful, you can then trash the folder containing the copied jpegs, since you'll have them in your iPhoto Library and backed up on the CD.

  • How can I get the image data from Clipboard with LV

    Anybody knows How can get the image data after pressd "print screen button" with LV?
    I want to program a software which can save a image as a bmp or jpeg etc, and the image data is from pressed print screen button. 
    How to get it out from clipboard. I am trapping about. thanks in advance.
    Try to make everything Automatic

    You can have a look at Rolf Kalbermatter's post here (give him stars) or, if you're using scripting, you can use the Application class Get Clipboard Image method.
    Try to take over the world!

  • I am unable to add jpeg attachments to my iPhoto album

    I am unable to add jpeg attachments to a received email to my iphoto album by click on the save/iPhoto pull dowen menu.  In prior systems a simple click would open iPhot and add the photos directy to it as a new event.  Now I have to open them in quick look, open iphoto and then drag and drop them to get them added.  Takes more time and is very cumbersom.
    Is there something that I am doing wrong or have not set a preference some where?  I am running the latest update to OS 10.8 and iPhoto.

    I've seen quite a few posts reporting this issue, and I know Apple is aware of it.  Meanwhile, you can get them to iPhoto either the way you suggested, or you can save the attachment, then drag it to iPhoto from the Downloads folder.

  • Unless I repair my hard drive every other day I am unable to delete songs from iTunes or email messages from Postbox. I've only had an iMac for a few weeks, is this normal?

    Unless I repair my hard drive every other day I am unable to delete songs from iTunes or email messages from Postbox. I've only had an iMac for a few weeks, is this normal?

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it, but you do need to follow the instructions below.
    Step 1
    If you have more than one user, and the one in question is not an administrator, then go to Step 2.
    Triple-click anywhere in the following line on this page to select it:
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR..; sudo chown -R $UID:staff ~ $_; sudo chmod -R u+rwX ~ $_; chmod -R -N ~ $_; } 2>&-
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window by pressing command-V. I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting.
    You'll be prompted for your login password. Nothing will be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command may take a few minutes to run, or perhaps longer if you have literally millions of files in your home folder. Wait for a new line ending in a dollar sign ($) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1, if it frightens you, or if it doesn't solve the problem.
    Start up in Recovery mode. When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password dialog will open. You’re not going to reset a password.
    In the dialog, select the startup volume ("Macintosh HD," unless you gave it a different name) if it's not already selected.
    Select your username from the menu labeled Select the user account if it's not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • Create jpeg from still frame in imovie

    Hello,
    Can anyone tell me how I can create a jpeg from a frame within imovie?
    Thanks so much.
    Ashley

    I was just trying to figure this out the other day and found that you can easily do this from QuickTime Pro. So you'd need to export a small movie from imovie that contains the frame you want to grab (or a movie you've already created), and then from QuickTime Pro, from the file menu, choose export, and then choose "movie to picture". From that menu box you can choose a range of options and file types to save your image file. I couldn't find this feature within imovie. If you don't have QT Pro, it is a $30 upgrade to the base QT Player.

  • How to have iPad (iOS 5) import only the JPEG from a RAW JPEG pair?

    I have an iPad 2 16 GB, running iOS 5. I also have a Canon EOS 7D. I purchased a CF Card Reader for the iPad (see http://store.micgadget.com/card-readers/280-ipad-2-cf-card-camera-connection-kit .html) so that I can view and edit photos quickly in the field, without having to lug my laptop around. To make this easier, I set my camera to shoot RAW+JPEG. I shoot with the smallest JPEG files possible, still a relatively large for the iPad 2,592x1,728, with the idea that I'd only import the JPEG files to the iPad, but still have the RAW files to work with when I get back to my computer. This works great with one exception: the iPad doesn't allow me to import only the JPEG files, but grabs the RAW files along with them. As you can imagine, this fills up my iPad rather quickly, and takes quite a bit longer to import than if it only grabbed the JPEGs.
    So here is my question: How do I have my iPad import only the JPEGs from the RAW+JPEG pairs on the memory card?
    One workaround that helps slightly. If I connect my iPad to my computer after the import, I can go in via Image Capture, select all the RAW images and delete them, leaving the JPEGs behind. This is an underwhelming solution, but does save space after the fact.

    What you are seeing is how Safari works now in iOS 5. There is no way to get that icon in Safari now. There other much better browsers available in the App Store. Look at iCab Mobile, Mercury, Atomic, ....
    I have been running iOS 5x for so long now, that I don't even remember if that icon did appear in earlier iOS versions

  • Exporting just jpegs from slides

    I have a 200+ slide powerpoint file which I opened in Keynote and I'd like to export just the images (not additional text) for use in Final Cut. Right now I'm taking the image from each individual slide into photoshop and exporting as jpeg from there. I've done 50 so far. Is there a faster way?

    You should be able to grab the images directly from the Keynote "package". In the Finder, hold down the Control key and click on the Keynote document -- this will bring up a contextual menu. Choose the "Show Package Contents" item. An new Finder window will open up showing all the files that make up the Keynote document (which is actually a special folder called a "package" that looks like a single file to the Finder). The images should all be at the top level of this new Finder window.

  • Unable to create envelope from given source:

    Hi all,
    1) actually i have wrote a servlet and i am trying to get a SOAPMessage from input stream...the code is as follows
    public void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException      {
              try
              {     InputStream inputStream= request.getInputStream();
                   InputStreamReader ir = new InputStreamReader(inputStream);
                   BufferedReader br = new BufferedReader(ir);
                   String theLine;
         while ((theLine = br.readLine()) != null)
         System.out.println(theLine);          
         MimeHeaders headers = getHeaders(request);
         MessageFactory msgFactory = MessageFactory.newInstance();
         SOAPMessage msg = msgFactory.createMessage(headers, inputStream);
         SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
         SOAPBody body = envelope.getBody();
              catch(Exception e)
                   e.printStackTrace();
    public MimeHeaders getHeaders(HttpServletRequest req) {
              Enumeration enum1 = req.getHeaderNames();
              MimeHeaders headers = new MimeHeaders();
              while (enum1.hasMoreElements()) {
              String headerName = (String)enum1.nextElement();
              String headerValue = req.getHeader(headerName);
              StringTokenizer values = new StringTokenizer(headerValue, ",");
              while (values.hasMoreTokens()) {
              try{
              String strValue = values.nextToken().trim();
              headers.addHeader(headerName, strValue);
              }catch (Exception e){
              System.out.println("SAAJ_Simple_Receive getHeaders: " + e);
              return headers;
    2) i have added mails.jar,saaj-api.jar,saaj-impl.jar,saaj-ri.jar,xalan.jar,activation.jar,xercesimpl.jar and servlet.jar
    3)but i am getting following exception
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
    13:39:29,986 ERROR [STDERR]      at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:148)
    13:39:29,986 ERROR [STDERR]      at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:102)
    13:39:29,986 ERROR [STDERR]      at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:156)
    13:39:29,986 ERROR [STDERR]      at InterceptorServletClass.doPost(InterceptorServletClass.java:88)
    13:39:29,986 ERROR [STDERR]      at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    13:39:30,018 ERROR [STDERR]      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    13:39:30,018 ERROR [STDERR]      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    13:39:30,018 ERROR [STDERR]      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    13:39:30,018 ERROR [STDERR]      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    13:39:30,018 ERROR [STDERR]      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    13:39:30,018 ERROR [STDERR]      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    13:39:30,018 ERROR [STDERR]      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    13:39:30,018 ERROR [STDERR]      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
    13:39:30,018 ERROR [STDERR]      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    13:39:30,018 ERROR [STDERR]      at java.lang.Thread.run(Unknown Source)
    4) can anyone plz tell me how would i resolve this problem... do i need to add any more jar fils?????
    thanks in adavance(waiting for reply)

    Try editing the file and put only the <SOAP-ENV:Envelope> XML into your file.
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Head
    er><edc:transid xmlns:edc="http://www.edc.com">4</edc:transid><edc:cmdid xmlns:edc="http://www.edc.com">50</edc:cmdid><edc:attDataInfo xmlns:edc="http://www.edc.com">.\testdata\FormExample.xml</edc:attDataInf o></SOAP-ENV:Header><SOAP-ENV:Body/></SOAP-ENV:Envelope>
    i.e remove all the "Part", "Content-type: text/xml", "image.jpeg" stuff.

  • Unable to import jpegs into Library

    HI all,
    I hoping somenone has come across a similar issue and resolved it. When trying to import my jpegs from both my iphone and my digital camera the import runs but at the end when prompted to keep originals or remove a message box prompts with the folllowing:
    Unreadable Files: 26
    The following files could not be imported.(the Import failed)
    Has anyone had this and resolved it. Its disastrous for me at the moment as i cannot back up all my photos of my new born girl.

    TD
    Thank you for your response, but unfortunately this did not help as i get the same issue as before - "The following files could not be imported (they may be an unrecognised file type or the files may not contain valid data)"
    I now have another problem, where when i now open iPhoto it comes up with this message box:
    25 photos were found in the iPhoto library that were not imported. Would you like to import them Yes or No.
    if i click yes it tries to import them, shows the above error message again (files could not be imported etc) then creates an album titled recovered photo's with no pictures in it.It also actually downloads the photos to a file on the HD titled " iPhoto Library Recovered Photos"
    If i click NO a message box appears stating " these photo's have been placed in folder xx/xx/xx etc titled " iPhoto Library Recovered Photos", so i now have 2 folders with the same pictures, but still unable to import. Plus i cannot stop iPhoto doing the above. every time i open it i get the above message and it creates a new recovered folder.
    I am now worse off than when i started.
    Help.

  • How do you make a jpeg from a clip

    How do you extract (or make) a jpeg from an iMovie clip. That is,the fairly new edition of iMovie?

    You could just make a screen grab of the video playing, that is the easiest.
    Open photos app, and play the video, pause where you want the image from.
    Then hold the power and home button to grab a still image of the screen.
    There is an app called videopix that can also grab full frame video grabs.

  • HT3529 i am unable to send sms from my iphone 4s

    i am unable to send sms from my iphone 4s

    Try Settings > General > Reset > Reset Network Settings.
    If that does not resolve, SMS is a carrier feature, contact the carrier.

  • Unable to capture data from drop down list in custom added field in migo tcode at item level

    Hi guys,
    need bit help in resolving query related to custom added field in Tcode migo.
    i have added a field in migo at item level ,in this i have used drop down list
    to get data but unable to capture data from drop down list.gown through
    many blogs in scn but unable to resolve.
    Please help me out in this.
    Thanks,
    Umakant.

    Hi,
    U can use following code to fill the list box
    write this code in PBO
    In layout editor please select listbox in dropdown attribute of input field and put some fctcode attribute
    TYPE-POOLS vrm.
      DATA values TYPE vrm_values WITH HEADER LINE.
      TABLES: <ur custom Database table>.
      clear values, values[].
      SELECT * FROM <ur custom Database table>.
        values-text = <TABLE FIELD TO DISPLAY IN DROPDOWN> .
        values-key = <TABLE KEY FIELD TO DISPLAY IN DROPDOWN>.
        APPEND values.
      ENDSELECT.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = '<SCREEN INPUT FIELD NAME>'
          values          = values[]
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    Also please define the following before accessing the listbox value
    data: <listbox input field name> type <table field name>,
            <inputfield name where text to display> type string  in top include
    In PAI, select the text from the table into <inputfield name where text to display>  depending on value selected which will be called when enter key is pressed or any vale is selected

Maybe you are looking for

  • Automatic billing and excise invoice in background

    Dear All, I have sheduled the background job for creation of invoice from billing Due list VF04.simultaneously excise invoice also should create when the billing documents are created in background for this i have made the configuration by enabling t

  • IPad Air - Calendar Viewing Configuration

    I am a new entrant into the Apple ownership world and recently purchased an iPad Air.  I have a question regarding the Calendar application and the viewing setup in the Day view. I have several calendars (work and home) setup.  When viewing a day, th

  • Blank Screen on Startup

    So here is how it happened. Started up my ibook today, everything was normal. Plugged in my Lacie External Hard drive, that was normal. Copied my user name folder to back up my files, everthing was going normal. I got an error saying there was some p

  • Force Black and White default on printer queue?

    Am I missing something easy or is it really this hard to force B&W to be the default when printing? I'm able to do this on the Windows 2003 server using the same Konica printer, but when I go to my SL Server I look all over in the queue and driver an

  • TYPE casting with SQL Server 2005

    Hi, I recently migrated to SQL Server 2005 database from Oracle 10g. I used the %TYPE operator in Oracle to cast to the appropriate column data type. PROCEDURE INS_USER                i_USERNAME               IN USERS.USERNAME%TYPE,                i_