• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic