Can't display an image...
this is a simple program i wrote; i have to use this Picture.class file that my professor provided, and thus i am having a lot of trouble undertand how to use the file with the program. eventually i will have to manipulate the image itself, but right now i can't even display it.
i am getting one error when i try to compile, read as: java/image/Picture.java:1: <identifier> expected
import Picture.class;
public class Picture
{
public static void main(String[] args){
Picture pic = new Picture("caterpillar.jpeg");
pic.showImage();
}
}
any ideas?
Re: Can't display an image...
You never import files with .class extensions.
if you have a Picture class in the package media, you would import media.Picture;
Do not name your class the same as ones you expect to find in the libraries provided by your professor, as it is bad practice and confusing.
Re: Can't display an image...
i have three files in one folder: one is the Picture.java file, one is the Picture.class file, and the other is the image i am trying to display.
if i use import media.Picture; then i get three errors. if i use import Picture; then i get two errors that read:
image/Picture.java:1: '.' expected
image/Picture.java:1: ';' expected
what am i doing wrong now?
Re: Can't display an image...
Haven't got a clue what you're on about sorry.
How new are you to Java? because it would be to everyone's benefit if you went over the tutorials first.
Post the code you have when you receive those errors.