+ 8
How to set image in java
7 Respostas
+ 9
Sεηιrυ ραsαη Yes for static images .
Although almost all components have icon property but only button and label shows properly
+ 8
You can set image on Labels using JLabel
and also on JButtons
+ 4
The easiest way would be using a JLabel.
For example,
new JLabel(new ImageIcon(PATH_OF_THE_IMG));
https://docs.oracle.com/javase/7/docs/api/javax/swing/ImageIcon.html#ImageIcon(java.lang.String,%20java.lang.String)
https://docs.oracle.com/javase/7/docs/api/javax/swing/JLabel.html#JLabel(javax.swing.Icon)
+ 4
Siddharth Golecha actually on almost all Components that accepts an Icon class. But I think JLabel is the most correct option for just displaying images 😊
+ 1
I cant do it too
0
What you name