So, I recently switched from BlueJ to Eclipse (Its soooo much better!), and while moving over some of my java files, I realized that Eclipse doesnt support Pictures… In BlueJ, to import a picture file, you would just do:
Picture picVariable = new Picture("PictureFile.bmp");
But, for some reason I get syntax errors doing that in Eclipse… How would I load up a picture in Eclipse?
Also, to show a Picture in BlueJ, you would just do:
picVariable.show();
…How would you do that in Eclipse?
Thanks!
I’m not familiar with BlueJ but the fact that you don’t need to do any imports tells me that ‘Picture’ is some BlueJ specific class.
When Eclipse says its can’t resolve the type that means it can’t find a definition for the class ‘Picture’ on your class path.
In normal Java its pretty easy to display a picture.
See the following mailing list thread for a very simple way:
http://www.java-forums.org/new-java/527-simplest-way-read-display-jpeg-image.html
The basic premise is you create an ImageIcon, then use a JLabel to render it (assuming you are using a SwingGui.