• 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

how do i get an image of the icon from an JLabel

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey ranchers..
I have JDeskTopPane ..in which I have a JInternalFrame....in which i have a JScrollPane...on the scroll pane i have a jlabel on which i have an image set as an icon ......
Now...how do i get back a reference to the image....
pls help...
pinju
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey try this
public Icon getIcon()
Returns the graphic image (glyph, icon) that the label displays.
Returns:
an Icon

[This message has been edited by dheeren patel (edited December 21, 2001).]
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...and once you get the Icon you have to see if it's an ImageIcon( the only icons that have images... ), so cast it to ImageIcon and call getImage(), which returns an Image.

-Nate
reply
    Bookmark Topic Watch Topic
  • New Topic