aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how do i get an image of the icon from an JLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how do i get an image of the icon from an JLabel" Watch "how do i get an image of the icon from an JLabel" New topic
Author

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

pinjalim bora
Greenhorn

Joined: Nov 26, 2001
Posts: 19
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


With regards<br />Pinjalim Bora(SCJP)<br />SE- SATYAM Computers
dheeren patel
Greenhorn

Joined: Dec 21, 2001
Posts: 1
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).]


dheeren the only one...
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

...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


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do i get an image of the icon from an JLabel
 
Similar Threads
Problems loading image into a JLabel located in a JScrollPane
Modifying a GridLayout/Changing Labels
Get Image on a JLabel
Adding a background image
humm imageIcon in an applet