Am creating a user interface in java.The panel is for helping the client to select an image. It has a text box for path and a browse button to search for files. Once the client has chosen a file, the preview must show the image.
If you look at the JFileChooser
tutorial , you will find an example on a file chooser with a preview area for images. Is that what you are looking for ?
..chosen a file...
If you want to show the preview after selecting the file,
image = ImageIO.read(new File(path));
JLabel picLabel = new JLabel(new ImageIcon(image));
Now add it to a frame or panel or anything like you usually do!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.