返回列表 發帖
  1. import javax.swing.JFrame;
  2. import javax.swing.JLabel;
  3. import javax.swing.ImageIcon;
  4. public class Ch87 {
  5.         
  6.         private JFrame fm;
  7.         private JLabel lb;
  8.         private ImageIcon icon;
  9.         
  10.         Ch87() {
  11.                 icon=new ImageIcon(Ch87.class.getResource("pic/01.jpg"));

  12.                 lb=new JLabel(icon);
  13.                 lb.setBounds(0, 0, 399, 300);
  14.                
  15.                 fm=new JFrame("ImageIcon 類別");
  16.                 fm.setBounds(100, 100, 405, 328);
  17.                 fm.setVisible(true);
  18.                 fm.setResizable(false);
  19.                 fm.setLayout(null);
  20.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  21.                 fm.add(lb);        
  22.         }
  23.                
  24.         public static void main(String[] args) {
  25.                 Ch87 app=new Ch87();
  26.         }
  27. }
複製代碼

TOP

返回列表