Загрузка...

How To Add Image in Swing JFrame |#coding #explore #java #swing #viralvideo @Error_programming

Learn how to add images to your Java Swing application in this tutorial. In this video, we'll walk through the process of incorporating an image into a Swing GUI using the ImageIcon class.

Watch the video to see the entire process in action. Don't forget to like, share, and subscribe for more Java Swing tutorials!
*Program*
import javax.swing.*;
import java.awt.*;

public class Main {
public static void main(String[] args) {

JPanel panel=new JPanel();
panel.setLayout(null);

JFrame frame=new JFrame();
frame.setSize(300,400);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setLocation(380,170);
frame.add(panel);
frame.setVisible(true);

ImageIcon ic=new ImageIcon("imp.png");

JLabel label=new JLabel(ic);
label.setBounds(-5,50,300,150);
panel.add(label);
}

}
@Error_programming

#coding #programming #explore #java #viralvideo #viral #php #javaprogramming #dsa

Видео How To Add Image in Swing JFrame |#coding #explore #java #swing #viralvideo @Error_programming канала Error
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки

На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.

Об использовании CookiesПринять