我刚刚编写了我的第一个JAVA应用程序,我想知道我必须做些什么来确保我的应用程序的框架始终充满图像。
我不关心图像是否在这里和那里略大于框架,但框架不能比图像大。
我已经阅读并搜索了很多内容,但我认为没有任何关于我的条件的信息。
这是我的代码,希望你能给我一些有用的提示:
public AdventureTrails() {
setTitle("AdventureTrails - Desktop-Application");
setSize(1000,600);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
setLayout(new BorderLayout());
setContentPane(new JLabel(new ImageIcon(AdventureTrails.class.getResource("src/background.jpg"))));
setLayout(new BorderLayout());
initMenu();
initComponents();
// Just for refresh :) Not optional!
setSize(999,599);
setSize(1000,600);
}