java double[][] - display as image
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 lib开发者_如何学Pythonrary, 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.
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.
精彩评论