1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
package paqIHM;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
public class testImg extends javax.swing.JFrame {
private static final long serialVersionUID = -4713672432547856626L;
private JLabel jLabel1;
public static void main(String[] args) {
testImg inst = new testImg();
inst.setVisible(true);
}
public testImg() {
super();
init();
}
private void init() {
try {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
JPanel pannel = new JPanel();
ImageIcon image = new ImageIcon("images/test.gif");
jLabel1 = new JLabel("salut",image, JLabel.CENTER);
pannel.add(jLabel1);
this.getContentPane().add(pannel);
pack();
} catch (Exception e) {
e.printStackTrace();
}
}
} |
Partager