Java Eclipse GUI Tutorial 7 # Add image, pictures and icons in JFrame

preview_player
Показать описание
★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!

JFrame Add Background Image .... Java NetBeans
How to set background with an image
Insert an image in a Java GUI using Netbeans ...
How to set a background image in Netbeans -
Handling Images in a Java GUI Application - NetBeans
How to insert image into jFrame
java - Trouble Adding Background Image to JFrame in Netbeans
java - how to put Image on JPanel using Netbeans
Netbeans IDE Users - Add images to gui
adding background image to JFrame
Setting an icon for a jFrame in Netbeans swing gui builder
Displaying an Image on JPanel in NetBeans
How to set an image as background using Java on Netbeans
Java code to change the icon image on a jFrame?
Set Image As JFrame Background - Java
How to Load Images in Java Using NetBeans
add image and button to Jframe
Netbeans Tutorials Adding an Image
iit Learn java netbeans
java tutorial netbeans
Рекомендации по теме
Комментарии
Автор

There sure are critics against the style of the video, but in the end he knew something I didn't and helped me out with my problem. thank you sir

perkelele
Автор

FF >> to 4:31 if you already have a grasp on the graphics/copyrights, etc.

Thanks for this!

neilguylindberg
Автор

I love you so much. Indian Developer are the best. Love those tutorials!!! <3

mrpartyld
Автор

Great video, one suggestion which will improve productivity. When selecting folder choose Package not Source folder. This then makes available in design view/Image Chooser, top selection button, Classpath Resources. Select this folder in parameters and images plus preview will show. Choose image and press OK. Source data will be automatically updated and only 1 (one) line of text data entered. No user interaction required.

markrashleigh
Автор

If you want to resize the image, you have to create a new instance of the image. By using this code:
Image newImage = img.getScaledInstance(90, 154, Image.SCALE_DEFAULT);
newImage is just the name of the new image, the "img." is the name of the previous image, and in the parenthesis (90, 154) is the new size of the image.

piro
Автор

use these packages:-
import javax.swing.Icon;
import javax.swing.ImageIcon;

AJAYKUMAR-vdpy
Автор

Thanks for this helpful tutorial series! Love from Bangladesh!

smdedar
Автор

Thank you! Been through all kind of forums, not one explained as well.

williamfilho
Автор

4 and a half minutes he's showing how to download an image

nikolabl
Автор

You can get any image you want and use an autosize site to make it fit.

hayian
Автор

Hello Sir,
First of all EXCELLENT tutorial, really helped me out. Sir I was on my major project and was thinking to add image that act as login button instead of using JButton or any idea that an image can be used in login process. Could you please help me out with it.

aakashdeep
Автор

Thanks so much! You explained this so well, way better than any other place I've been to :)

truekip
Автор

Exactly what I need! Thanks!!! Too clear :)

jasonaraosfuentes
Автор

Awesome video! keep up the good work :)

mackkek
Автор

Many had pix trouble. Not your fault. The way that works is:
ImageIcon icon = new ImageIcon ("img/ET.png");
JLabel lblNewLabel2 = new JLabel("");
lblNewLabel2.setIcon(icon);
lblNewLabel2.setBounds(25, 221, 300, 230);

There was a lblNewLabel above somewhere, so I had to distinguish the two.

patrickedwinmoran
Автор

I've had a little mistake in the very end of this tutorial. I've wrote this:

Image img=new
button_Login.setIcon(new ImageIcon(img));

and the compiler gave me an error message:

"Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
Duplicate local variable img"


The right thing to do was to write something different that just "img". Like "img1"
That have solved the problem.

ОлександрХудяков-нр
Автор

I am getting a error with the "this" keyword, cannot use this in static context, how do I fix this?

kameerhosein
Автор

Code to resize image if it does not fit :
int y = addImage.getHeight(new ImageObserver() {

@Override
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
// TODO Auto-generated method stub
return false;
}
});
int x = addImage.getWidth(new ImageObserver() {

@Override
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
// TODO Auto-generated method stub
return false;
}
});
img = img.getScaledInstance(x, y, Image.SCALE_FAST);

rohit-gupta
Автор

The imagem still didnt work.
I put like this
Image img = new
label.setIcon(new ImageIcon(img));
and the image didnt show in the design and the aplication give me always a error of nullpointer right where i declared he image.

And i had to choose another name  delare the image of the button.

Some ideia what should i do?

keziacp
Автор

you have to change also img variable name, otherwise you can't run your program 'cause of "Duplicate local variable img" error

slimakdrzewny
join shbcf.ru