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