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 42 43 44 45 46 47 48 49 50 51
|
package list;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import com.sagem.morpho.criminalcaseedition.data.casse.CasePortrait;
public class Dessin extends JPanel {
/** Icon1. */
private ImageIcon icon1 = null;
/** Icon2. */
private ImageIcon icon2 = null;
/** Label. */
private JLabel label = null;
public Dessin(){
super();
initialize();
}
private void initialize(){
this.setSize(600, 600);
this.setLayout(null);
this.setBackground(Color.white);
this.icon1 = getIcon("C:\\jeux de test\\1.jpg");
this.icon2 = new ImageIcon(this.icon1.getImage().getScaledInstance(100, 100, Image.SCALE_DEFAULT));
this.label = new JLabel(this.icon2);
this.label.setBackground(Color.yellow);
this.label.setBounds(50, 50, 80, 80);
this.add(label);
}
public void paintComponent(Graphics gc)
{
gc.setColor(Color.green);
gc.fillRect(30, 30, 30, 30);
}
private ImageIcon getIcon(final String name) {
return new ImageIcon(name);
}
} |