简体   繁体   English

是否在不使用Swing的情况下将图像添加到GUI? Java的

[英]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? 但是,当您扩展Frame时呢? Is it possible to add images to the GUI? 是否可以将图像添加到GUI?

If you don't use Swing then use AWT (on top of my head from 15 years memory): 如果您不使用Swing,请使用AWT(在15年的记忆中,我记忆犹新):

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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