• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

export image on Label

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My java code below features a blank label and a button that calls a func that exports a image. Right now in the func the code exports a image on the computer. You can see this in     new File("/Users/johnzalubski/Desktop/javaCode/cd.jpg"). Check out the comment above that line. What I want to do is export whatever image is placed on Label b2. You can just assume a image is placed on the label even though one is not there right now.

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JLabel has a getIcon() method which gets the Icon which is displayed on the label. You could start with that.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not understanding your terminology:

1. export - means you want to write to the file
2 import - means you want to read from a file

So I'm not sure why your "export" function has a read method?

If you want to export the image on the label then you would do something like:
 
reply
    Bookmark Topic Watch Topic
  • New Topic