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
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
Комментарии отсутствуют
Информация о видео
25 декабря 2023 г. 15:08:22
00:02:39
Другие видео канала