close
I used to beaten by the complex code when I want to show a picture using Java GUI
However, I sucess today ....
Below is what I've implemented:
1. convert BufferedImage type to ImageIcon ex: ImageIcon icon=new ImageIcon(bufferedImage);
2. creat object JLabel ex: JLabel label=new JLabel(icon);
3. creat object JFrame :
JFrame frame=new JFrame("Result");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(label);
frame.setSize(200,200);
frame.setVisible(true);
4. Now you can display the result image.
全站熱搜