本文介绍了在JPanel上显示jpg图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在JPanel上显示jpg图像(从本地文件夹加载)最合适的图像类型是什么?
What would be the most appropriate image type to display a jpg image (loaded from a local folder) on a JPanel?
干杯。
推荐答案
ImageIcon image = new ImageIcon("image/pic1.jpg");
JLabel label = new JLabel("", image, JLabel.CENTER);
JPanel panel = new JPanel(new BorderLayout());
panel.add( label, BorderLayout.CENTER );
这篇关于在JPanel上显示jpg图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!