Load Image from Path to JLabel in Java


Image is one of the file formats that can help your designs more attractive. There are many types of image that we can use in Web or Desktop applications, the jpeg, gif, png, and bitmap extensions.

This tutorial entitled “Load Image from Path to JLabel in Java” will help you to understand on how to load an image from path to a jLabel element in Java. This tutorial will use jLabel, jTextField, and jButton to complete this tutorial.

Load Image Path JLabel Using Java Steps

  1. Create/Add a new jFrame Form in your project

2. Design your jFrame form just look like the image below.

3. Add the following imports above your class to access the library for Image, and Icon.

4. Double click your button and add the following codes below


jTextField1 (Image path)

360 (Image Width)

171 (Image Height)

jLabel1 (Display the Image)

5. Run your program and it should look like the image below.

If you have any questions or suggestion about Load Image Path JLabel using Java, Please feel free to contact us at our contact page.

Looking for more source code? Type your keyword here here!


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.