views:

55

answers:

2

Hi all,

just wondering if there is a simple way in java to display the contents of say 16x16 array of doubles [0..1] as a greyscale image (ala matlab)? using an unfamiliar matrix library, so I'd like to check that I'm on the right track. don't really care if it is slow or ugly, or if it requires external library - it's just there for a quick look, so as long as it works, I'm fine.

A: 

Take a look at java.awt.MemoryImageSource.

The javadoc gives an example of how to use this class similar to what you need.

The Component.createImage(ImageProducer) method can then convert this into an Image that you can display in swing components with an ImageIcon.

Aaron
exactly what I needed, thanks a lot! even better, the whole method takes only 20 lines from preparation to a jframe.
joe_shmoe