返回列表 發帖
  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.         {
  12.                 icon=new ImageIcon(Ch87.class.getResource("pic/01.jpg"));

  13.                 //lb=new JLabel(new ImageIcon(Ch87.class.getResource("pic/01.jpg")));
  14.                 lb=new JLabel(icon);
  15.                 lb.setBounds(0, 0, 399, 300);
  16.                
  17.                 fm=new JFrame("ImageIcon 類別");
  18.                 fm.setBounds(100, 100, 405, 328);
  19.                 fm.setVisible(true);
  20.                 fm.setResizable(false);
  21.                 fm.setLayout(null);
  22.                 fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  23.                 fm.add(lb);        
  24.         }
  25.                
  26.         public static void main(String[] args) {
  27.                 Ch87 app=new Ch87();
  28.         }
  29. }
複製代碼
一年不見,如隔四季

TOP

返回列表