This topic is now archived and is closed to further replies.

[java] Displaying images and drawing in a gui application?

This topic is 5376 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an application I have written, but I can''t seem to get some logos and stuff I have to display within the gui. Ideally I''d like to put the picture in its own little panel. Any advice on how to do this display within an application would be appreciated. Thanks.

Share this post

Link to post
Share on other sites
Hi CPops57,

try a JLabel with an image:

JFrame mainFrame = new JFrame("JLabel test");
Container cPane = mainFrame.getContentPane();
cPane.setLayout(new BorderLayout());
cPane.add(new JLabel( new ImageIcon( "../logo1.png" ) ), BorderLayout.CENTER );

that should do it.

have fun

Share this post

Link to post
Share on other sites