
-----------------------------------
Jonny Tight Lips
Thu Sep 08, 2005 6:22 pm

Help with images
-----------------------------------
Well I have tryed and tryed but I just can't seem to get the image to show up. So far this is what I've got:


import java.awt.*;
import javax.swing.*;
 
 public class Image {
        public static void main(String[] args) {
            new Image();
        }
        Image() {
            JFrame frame = new JFrame();
    
            frame.getContentPane().add(new MyComponent());

            frame.setSize(300, 300);
            frame.setVisible(true);
        }
    
        class MyComponent extends JComponent {
            public void paint(Graphics g) {
				Image image =     Toolkit.getDefaultToolkit().getImage("homer.gif");
 				g.drawImage(image, 0, 0, this);
            }
        }
    }


Yes this is probably horably wrong but thats as far as I can get. So any help you can give me would be nice. I just can seam to get this. Thx

-----------------------------------
rizzix
Thu Sep 08, 2005 6:28 pm


-----------------------------------
one big mistake you made is call your class Image... change it to Test or something then try again.

-----------------------------------
Jonny Tight Lips
Fri Sep 09, 2005 3:32 pm


-----------------------------------
Thx I finaly got it. Time to move on to movement.
