• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

problem while pasting images on to the java application from Mac Systemclipboard

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

i am creating a photouploader tool for Mac . i am using using java1.4.2 on Mac OS x.

i have a problem while pasting images on to the java application from Mac Systemclipboard

i am able to copy only one image file from the system clipboard and paste it on the java application. ie., the jList.

if i copy more than one image file into the system clipboard, the paste operation does not work.

i have this problem only when i run the application on mac os.
On windows i am able to paste any number of images on to the java application - it works fine!!!

i need help on this ... The code portion for the 'paste' operaton is below
=================================================================
1. Toolkit kit = Toolkit.getDefaultToolkit();
2. final Clipboard clipboard = kit.getSystemClipboard();
3. Transferable tr = clipboard.getContents(clipboard);
4. try{
5. java.util.List fileList = (java.util.List)tr.getTransferData(DataFlavor.javaFileListFlavor);
6. Iterator iterator = fileList.iterator();
7. while (iterator.hasNext())
8. {
9. File file = (File)iterator.next();
10. ((DefaultListModel)jList.getModel()).addElement(new JLabel(getImage(file)));
11. }
12. } catch(UnsupportedFlavorException no){ no.printStackTrace();}
13. catch(IOException io){io.printStackTrace();}
=================================================================
i get the following exception at line 4.. when i tried to paste 3 .gif files �and works for one gif file

java.awt.datatransfer.UnsupportedFlavorException: application/x-java-file-list
� � � � at sun.awt.datatransfer.ClipboardTransferable.getTransferData(ClipboardTransferable.java:168)
� � � � at UploadPhotosPane.pasteActionPerformed(UploadPhotosPane.java:778)
� � � � at UploadPhotosPane$19.actionPerformed(UploadPhotosPane.java:553)



any help on this is highly appreciated,
its urgents also

Thanks in advance
kalpana
 
Sheriff
Posts: 67537
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"psk",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Bear Bibeault
Sheriff
Posts: 67537
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P.S. Claiming that your post is "urgent" is a good way to get it ignored. I'd edit that part out were I you.
 
kalpana s
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi bear,

i have changed my display name as per your suggestion and reposting the same question again

------------------------------------------------------------------------
i am creating a photouploader tool for Mac . i am using using java1.4.2 on Mac OS x.

i have a problem while pasting images on to the java application from Mac Systemclipboard

i am able to copy only one image file from the system clipboard and paste it on the java application. ie., the jList.

if i copy more than one image file into the system clipboard, the paste operation does not work.

i have this problem only when i run the application on mac os.
On windows i am able to paste any number of images on to the java application - it works fine!!!

i need help on this ... The code portion for the 'paste' operaton is below
=================================================================
1. Toolkit kit = Toolkit.getDefaultToolkit();
2. final Clipboard clipboard = kit.getSystemClipboard();
3. Transferable tr = clipboard.getContents(clipboard);
4. try{
5. java.util.List fileList = (java.util.List)tr.getTransferData(DataFlavor.javaFileListFlavor);
6. Iterator iterator = fileList.iterator();
7. while (iterator.hasNext())
8. {
9. File file = (File)iterator.next();
10. ((DefaultListModel)jList.getModel()).addElement(new JLabel(getImage(file)));
11. }
12. } catch(UnsupportedFlavorException no){ no.printStackTrace();}
13. catch(IOException io){io.printStackTrace();}
=================================================================
i get the following exception at line 4.. when i tried to paste 3 .gif files and works for one gif file

java.awt.datatransfer.UnsupportedFlavorException: application/x-java-file-list
at sun.awt.datatransfer.ClipboardTransferable.getTransferData(ClipboardTransferable.java:168)
at UploadPhotosPane.pasteActionPerformed(UploadPhotosPane.java:778)
at UploadPhotosPane$19.actionPerformed(UploadPhotosPane.java:553)



any help on this is highly appreciated,

Thanks in advance
kalpana
 
Bear Bibeault
Sheriff
Posts: 67537
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"kalpana",

Apparently you missed this part:

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.



thanks,
bear
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[Post removed. Any discussion of the naming policy should take place in the JavaRanch forum. -- Bear]
[ July 29, 2004: Message edited by: Bear Bibeault ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic