Jump to content
  • Advertisement

Archived

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

CPops57

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

This topic is 5562 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
Advertisement
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 );
mainFrame.setVisible(true);
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);


that should do it.

have fun

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!