Displaying an image through an array
So, I have an image that the user has selected and altered in some way, which is then read into a 2D array (which all works fine). I essentially need to be able to use JLabel to display this image by reading the array it is provided.
Now, some explanation of my code is needed. "image" is the array in question, and I've written all the other methods to modify this array as needed, and the information will be stored. I know this works. "displayGrayscaleImage" is a method that takes the array, which was originally just a color image read into an array, and turns it into a grayscale. This also works, but I think this may be the problem. Since the image is already gray, it doesn't need to enter this method again, but I don't know how to create a method that will display the image by reading the array into my JLabel called "imageLabel".
This is in the method that creates all needed buttons, JPanels, and the JLabel in question.
The problem, I believe, is in bold. Essentially, I need a method that will take in an array and output an image based on the array. If I'm not mistaken, the name of the method would be where "displayGrayscaleImage" is.
JPanel JPANEL_C = new JPanel();
JLabel imageLabel = new JLabel(new [B]ImageIcon(displayGrayscaleImage(image))[/B]);