gif in JFrame

F

focode

i want to introduce a gif image file into my Jframe . how can i achive
this , also if it is possible through netbeans then tell me that also

thanks
 
S

Stefan Rybacki

focode said:
i want to introduce a gif image file into my Jframe . how can i achive
this , also if it is possible through netbeans then tell me that also

JFrame frame=new JFrame();
frame.add(new JLabel("image.gif"));
frame.setSize(100,100);
frame.setVisible(true);

There you introduce a gif image file represented by name into your JFrame.

Is this not what you meant? I've guessed so, make your self clearer next time.


Stefan
 
S

softwarepearls_com

JFrame frame=new JFrame();
frame.add(new JLabel("image.gif"));
frame.setSize(100,100);
frame.setVisible(true);

There you introduce a gif image file represented by name into your JFrame..

Is this not what you meant? I've guessed so, make your self clearer next time.

Stefan

I think you forgot the "new ImageIcon" bit
 
S

Stefan Rybacki

softwarepearls_com said:
I think you forgot the "new ImageIcon" bit

Not really, I just introduced the image file as the OP wanted. Not the image in
that file. I just wanted to point out, that his explanation of what he's trying
to achieve is insufficent.

Stefan
 
D

Daniel Pitts

focode said:
i want to introduce a gif image file into my Jframe . how can i achive
this , also if it is possible through netbeans then tell me that also

thanks
frame.add(new JLabel(new ImageIcon("myImage.gif")));
 
D

Daniel Pitts

Stefan said:
Not really, I just introduced the image file as the OP wanted. Not the
image in that file. I just wanted to point out, that his explanation of
what he's trying to achieve is insufficent.

Human communication is often insufficient, however humans also generally
have the ability to extract the proper meaning out of insufficient
communications. They call it inference.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top