ScrollingImagePanel

0 respostas
B

caras… não sei o q está acontecendo, mas depois de compilar tudo bonitinho o código ele aparece a mensagem: Exception in thread “main” java.lang.NoClassDefFoundError: javax/media/jai/widget/ScrollingImagePanel

sendo que o código eu peguei no site da SUN… acho que o meu JAI tá bichado… eu intalei a versão 1.1.1_01, mas ele coloca o tal do jar no diretorio do JDK e lá tá a classe ScrollingImagePanel… ah e ainda pede pra compilar com o -deprecation por causa do ScrollingImagePanel:

import java.awt.image.renderable.ParameterBlock;
     import java.io.File;
     import javax.swing.*;
     import javax.media.jai.JAI;
     import javax.media.jai.PlanarImage;
     import javax.media.jai.RenderedOp;
     import javax.media.jai.widget.ScrollingImagePanel;

     public class FileTest{
     public static final String DEFAULT_FILE = "aviao.jpg";

         public static void main(String args[]) {
             String fileName = null;

             if(args.length == 0) {
                 fileName = DEFAULT_FILE;
             } else if(args.length == 1) {
                 fileName = args[0];
             } else {
                 System.out.println("
Usage: java " + (new FileTest()).getClass().getName() +
                                    " [file]
");
                 System.exit(0);
             }

             new FileTest(fileName);
         }

         public FileTest() {}
         public FileTest(String fileName) {
		JFrame frame = new JFrame("Teste");
        System.out.println("Creating operation to load image from '" + fileName+"'");
        RenderedOp img =  JAI.create("fileload", fileName);

        frame.setTitle(getClass().getName()+": "+fileName);

             System.out.println("Displaying image");
	     frame.add(new ScrollingImagePanel(img,img.getWidth(),img.getHeight()));
             frame.pack();
             frame.show();
         }
     }
Criado 29 de janeiro de 2003
Respostas 0
Participantes 1