返回列表 發帖
  1. import javax.swing.ImageIcon;
  2. import javax.swing.JFrame;
  3. import javax.swing.JLabel;


  4. public class Ch87 {
  5.        
  6.         JFrame fm;
  7.         JLabel lb;
  8.         ImageIcon ic;
  9.        
  10.         Ch87()
  11.         {
  12.                
  13.                 ic=new ImageIcon(Ch87.class.getResource("pic/01 (2).jpg"));
  14.                
  15.                 lb=new JLabel(ic);
  16.                 lb.setBounds(0,0,399,300);
  17.                
  18.                
  19.                
  20.                 fm=new JFrame("ImageIcon Practice");
  21.                 fm.setBounds(100, 100, 405, 328);
  22.                 fm.setVisible(true);
  23.                 fm.setResizable(false);
  24.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  25.                 fm.setLayout(null);
  26.                 fm.add(lb);
  27.                                
  28.         }
  29.         public static void main(String[] args) {
  30.                 new Ch87();

  31.         }

  32. }
複製代碼

TOP

返回列表