• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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
 
Yeah, but is it art? What do you think tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic