简体   繁体   中英

Adding image to GUI without using Swing? Java

Not sure if it is possible because everywhere I see this question being asked, the answer always involves using swing. But what about when you are extending Frame? Is it possible to add images to the GUI?

If you don't use Swing then use AWT (on top of my head from 15 years memory):

Frame frame=new Frame("Your Image");
BufferedImage img = ImageIO.read(new File("you.jpg"));
frame.add(img);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM