Java Swing Tutorial 23 - How to add Image in Netbeans Java - Part 1

Veröffentlicht am: 31 Juli 2013
auf dem Kanal: Ravi Punekar
10,578
17

Title : Netbeans Java Tutorial 23 - How to add Image in Netbeans Java - Part 1

IDE : NetBeans IDE lets you quickly and easily develop Java desktop, mobile, and web applications
Netbeans have so many built in plugins by which you can perform many operations and tasks

ADDING IMAGE TO JFRAME

I this Video we will see how to add an image in JFrame using Netbeans IDE.

First of all you will have to create and ImageIcon object

ImageIcon icon=new ImageIcon(//Here just give the path of the image location);

then just add the ImageIcon object in the JLabel

JLabel label=new JLabel(icon);

This Video basically satisfies all your queries regarding adding images in mind like
How to set a background image in Netbeans
How to insert image into jFrame
Setting an icon for a jFrame in Netbeans swing
Set Image As JFrame Background

Here is the code below

import java.awt.FlowLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class AddImage extends JFrame {

AddImage()
{

ImageIcon icon=new ImageIcon("G:\\Movies\\Photos\\Untitled.png");
JLabel label=new JLabel(icon);

setLayout(new FlowLayout());
add(label);

setSize(500,400);
setLocation(200,200);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);

}
public static void main(String args[])
{
new AddImage();
}

}


Auf dieser Seite können Sie das Online-Video Java Swing Tutorial 23 - How to add Image in Netbeans Java - Part 1 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Ravi Punekar 31 Juli 2013 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 10,578 Mal angesehen und es wurde von 17 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!