| Author |
Get Image on a JLabel
|
dushantha Rathnayake
Ranch Hand
Joined: Feb 27, 2010
Posts: 91
|
|
Hi,
I did set an icon for a jlabel. In another situation i want to get the image on that jlabel. How can I get the image? please help me.
thank you.
|
 |
Michael Dunn
Rancher
Joined: Jun 09, 2003
Posts: 4041
|
posted

1
|
if
"I did set an icon for a jlabel" = setIcon(..)
then
"How can I get the image?" = ?
should be easy to work out
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 3905
|
|
|
check the JLabel API you will find a method there that returns the Icon. not sure if you can directly assign the Icon to an Image though
|
I never took notes in college. That's how I got a 4.0 the first 2 years, and a 3.5 the second two years.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 3218
|
|
Randall Twede wrote:not sure if you can directly assign the Icon to an Image though
You can't. But if the Icon is an ImageIcon, you can cast and get the Image from that.
The real question here is how we should interpret what dushantha actually wants to do with the image.
|
luck, db
There are no new questions, but there may be new answers.
|
 |
 |
|
|
subject: Get Image on a JLabel
|
|
|