handling picture within a frame

how can i show and hide a picture(like a tringle which contain an exclamation mark)
in a frame which contains a group of radiobutton at selecting
one of these radiobutton.
the symbol must be shown in front of the radiobutton.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use a JLabel to add the image to the screen, OR a JButton, here's an example:

ImageIcon imgIc = new ImageIcon( "image.gif" );
JButton jb = new JButton( imgIc );
jb.setSize( x, y );
jb.setBorderPainted( false );

Then, when they select the radiobutton, it gets the image name from an array, and uses this to replace it:

imgIc = new ImageIcon( "NewImage.gif" );
jb = new JButton( imgIc );


I think that should do it -- what do you think?? :-)

>"the symbol must be shown in front of the radiobutton."
...what do you mean by this exactly? :o\

You can add the picture to the radiobutton, by  .setIcon(Icon) or by creating the RadioButton(Icon),
ans set it in front by .setHorizontalAlignment(SwingConstants.*);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hi V,
to save you the decission; award sciuriware with the points, please. :-)

I'm honoured.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.