返回列表 發帖
  1. import javax.swing.JFrame;
  2. import javax.swing.JLabel;
  3. import javax.swing.ImageIcon;
  4. public class Ch84
  5. {

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

  26.         }

  27. }
複製代碼

TOP

返回列表