ITPub博客

首页 > Linux操作系统 > Linux操作系统 > JFrame中插图片

JFrame中插图片

原创 Linux操作系统 作者:China_4 时间:2008-05-08 03:00:11 0 删除 编辑

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/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-03-31

  • 博文量
    18
  • 访问量
    29443