首页 > Linux操作系统 > Linux操作系统 > JFrame中插图片
public class Landing extends JFrame{
ImageIcon img;
public Landing() {
img = new ImageIcon("denglu.jpg");
JPanel panel = new JPanel() {
public void paintComponent(Graphics g) {
g.drawImage(img.getImage(), 0, 0, null);
super.paintComponent(g);
}
};
panel.setOpaque(false);
setContentPane(panel);
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
入口可以单独写在Application类中
Landing frame. = new Landing();
frame.setBounds(0, 0, 0, 0);
frame.setVisible(true);
frame.setTitle(" ");
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13683607/viewspace-263105/ ,如需转载,请注明出处,否则将追究法律责任。