-2

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=...
shayan
  • 29
  • 6
  • It is inherently complex to place an image on the screen because a supporting UI element is required to display the image. – Compass Dec 08 '14 at 21:22

1 Answers1

2

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);
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366