- import javax.swing.ImageIcon;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- public class Ch87 {
- JFrame fm;
- JLabel lb;
- ImageIcon ic;
-
- Ch87()
- {
- ic=new ImageIcon(Ch87.class.getResource("pic/01.jpg"));
-
- lb=new JLabel(ic);
- lb.setBounds(0, 0, 399, 300);
-
- fm=new JFrame("ImageIcon 練習");
- fm.setBounds(100, 100, 405, 328);
- fm.setVisible(true);
- fm.setResizable(false);
- fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- fm.setLayout(null);
- fm.add(lb);
- }
-
-
- public static void main(String[] args) {
- new Ch87();
- }
- }
複製代碼 |