what is the easiest way to print a BufferedImage object (an image) on screen in java eclipse? iv red some ways but those are so much in detail:
BufferedImage img=...
what is the easiest way to print a BufferedImage object (an image) on screen in java eclipse? iv red some ways but those are so much in detail:
BufferedImage img=...
For Swing...
Use a JLabel
, see How to Use Labels for more details.
To read an image use ImageIO.read
, see Reading/Loading an Image for more details.
You will need to wrap the resulting BufferedImage
in an ImageIcon
before you can set it to the JLabel
...
BufferedImage img = ImageIO.read(...);
ImageIcon icon = new ImageIcon(img);
JLabel label = new JLabel(icon);