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
|
package paquet1;
import javax.swing.*;
import javax.media.jai.*;
import com.sun.media.jai.widget.DisplayJAI;
import java.awt.*;
public class Test1 extends JFrame {
private JLabel label;
private JScrollPane defilement;
private PlanarImage image;
private DisplayJAI afficheur;
public Test1(String name){
super(name);
this.getContentPane().setLayout(new BorderLayout());
image = JAI.create("fileload","paquet1/images/image1.jpg");
afficheur = new DisplayJAI(image);
defilement = new JScrollPane(afficheur);
this.getContentPane().add(defilement,BorderLayout.CENTER);
label = new JLabel(image.getHeight()+"x"+image.getWidth());
this.getContentPane().add(label,BorderLayout.SOUTH);
this.setSize(300,300);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
} |
Partager