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


  4. public class Ch87 {

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

TOP

返回列表