HOW TO RESIZE the png ImageIcon import java.awt.*;
HOW TO RESIZE the png ImageIcon
import java.awt.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.ImageIcon;
import java.awt.image.BufferedImage;
public class FreeGoal extends JFrame {
JPanel jp = new JPanel();
JLabel jl = new JLabel();
public FreeGoal() {
setTitle("Testing");
setVisible(true);
setSize(400,300);
setBackground(Color.white);
setDefaultCloseOperation(EXIT_ON_CLOSE);
jl.setIcon(new ImageIcon("C:\\Users\\user\\OneDrive\\Pictures\\Screenshots\\unity.png"));
jp.add(jl);
add(jp);
validate();
}
public static void main(String args[]) {
FreeGoal pic = new FreeGoal();
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images