返回列表 發帖
  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(icon);
  14.                 lb.setBounds(0, 0, 399, 300);  
  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

返回列表