Hi,

I wrote a while back about having problems with the ImageComponent2D constructor. I am 
still stuck on this. I was told that a NullPointerException occurred as the ColorModel 
was set to null for my image. I tried to fix that by setting a ColorModel for the 
object. I read that the ColorModel should have same transfer type as the sample model 
of the image. Here is the code fragment I used. This code fragment is used to create a 
RenderedImage. It uses JAI to decode DICOM images

sampleModel
            = RasterFactory.createPixelInterleavedSampleModel(DataBuffer.TYPE_SHORT,
                                                              width,
                                                              height,
                                                              1);



        //create a ColorModel object
        ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
        int bits[] = new int[] {8};
        colorModel = new 
ComponentColorModel(cs,bits,false,false,Transparency.OPAQUE,DataBuffer.TYPE_SHORT);
Now I get an unsupported method error. I am not allowed to use TYPE_SHORT.

Exception occurred during event dispatching:
java.lang.UnsupportedOperationException: This method has not been implemented for 
transferType 2

        at 
java.awt.image.ComponentColorModel.extractComponent(ComponentColorModel.java:372)
        at 
java.awt.image.ComponentColorModel.getRGBComponent(ComponentColorModel.java:315)
        at java.awt.image.ComponentColorModel.getRed(ComponentColorModel.java:425)
        at 
javax.media.j3d.ImageComponentRetained.copyImage(ImageComponentRetained.java:371)
        at 
javax.media.j3d.ImageComponent2DRetained.set(ImageComponent2DRetained.java:370)
        at javax.media.j3d.ImageComponent2D.<init>(ImageComponent2D.java:103)
        at BrainGUI.actionPerformed(BrainGUI.java:178)
        at java.awt.MenuItem.processActionEvent(MenuItem.java:526)
        at java.awt.MenuItem.processEvent(MenuItem.java:490)
        at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:266)
        at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:256)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:336)
        at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:126)
        at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)

Can someone also tell me how I can find out what these exceptions mean, and how I can 
figure out what I am doing wrong? I am sorry if this problem seems too simple. I am 
very new to Java.


__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the 
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to