Unable to recognise ImageViewer...

R

RayKnight

This is the coding I used, I got it directly from a Java book titled
"Introduction to Java Programming - Comprehensive Version 5th Edition"

"import javax.swing.*;
import java.awt.*;

public class Flags extends javax.swing.JApplet
{
public Flags()
{
ImageViewer imageViewer1 = new ImageViewer();
ImageViewer imageViewer2 = new ImageViewer();
ImageViewer imageViewer3 = new ImageViewer();
ImageViewer imageViewer4 = new ImageViewer();
ImageViewer imageViewer5 = new ImageViewer();
ImageViewer imageViewer6 = new ImageViewer();

getContentPane().setLayout(new java.awt.GridLayout(2, 0, 5, 5));
imageViewer1.setImageFilename("/image/us.gif");
getContentPane().add(imageViewer1);
imageViewer2.setImageFilename("/image/ca.gif");
getContentPane().add(imageViewer2);
imageViewer3.setImageFilename("/image/india.gif");
getContentPane().add(imageViewer3);
imageViewer4.setImageFilename("/image/uk.gif");
getContentPane().add(imageViewer4);
imageViewer5.setImageFilename("/image/china.gif");
getContentPane().add(imageViewer5);
imageViewer6.setImageFilename("/image/norway.gif");
getContentPane().add(imageViewer6);
}
}"

It does not allow me to compile and keeps saying they 'cannot find
symbol'

What is wrong?
 
C

Chris Smith

RayKnight said:
This is the coding I used, I got it directly from a Java book titled
"Introduction to Java Programming - Comprehensive Version 5th Edition"

Where is this ImageViewer class? It's not part of the core API.
Perhaps it is another code sample from the book? Is there a CD with the
book that might contain the class?

At the moment, I'm siding with the compiler. I also have no clue what
you mean by ImageViewer.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
R

RayKnight

"Where is this ImageViewer class? It's not part of the core API.
Perhaps it is another code sample from the book? Is there a CD with the
book that might contain the class?"

Yeah, I've done a file that compiled perfectly with the ImageViewer thing
which I assume is supposed to be part of the file I listed above.

But it doesn't seem to work.
 
C

Chris Smith

RayKnight said:
Yeah, I've done a file that compiled perfectly with the ImageViewer thing
which I assume is supposed to be part of the file I listed above.

But it doesn't seem to work.

Unfortunately, I have no idea what you just said. I doubt anyone else
does either. The question is the same: where is ImageViewer?

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
V

Virgil Green

RayKnight said:
This is the coding I used, I got it directly from a Java book titled
"Introduction to Java Programming - Comprehensive Version 5th Edition"

"import javax.swing.*;
import java.awt.*;

public class Flags extends javax.swing.JApplet
{
public Flags()
{
ImageViewer imageViewer1 = new ImageViewer();
ImageViewer imageViewer2 = new ImageViewer();
ImageViewer imageViewer3 = new ImageViewer();
ImageViewer imageViewer4 = new ImageViewer();
ImageViewer imageViewer5 = new ImageViewer();
ImageViewer imageViewer6 = new ImageViewer();

getContentPane().setLayout(new java.awt.GridLayout(2, 0, 5, 5));
imageViewer1.setImageFilename("/image/us.gif");
getContentPane().add(imageViewer1);
imageViewer2.setImageFilename("/image/ca.gif");
getContentPane().add(imageViewer2);
imageViewer3.setImageFilename("/image/india.gif");
getContentPane().add(imageViewer3);
imageViewer4.setImageFilename("/image/uk.gif");
getContentPane().add(imageViewer4);
imageViewer5.setImageFilename("/image/china.gif");
getContentPane().add(imageViewer5);
imageViewer6.setImageFilename("/image/norway.gif");
getContentPane().add(imageViewer6);
}
}"

It does not allow me to compile and keeps saying they 'cannot find
symbol'

What is wrong?

Try posting your exact error message since none of us has a clue as to which
line of code is being identified as being in error.
 
R

RayKnight

Flags.java.13: cannot find symbol
symbol: class ImageViewer
location: class Flags
ImageViewer imageviewer1 = new ImageViewer();

With two ^ point at the first and last ImageViewer.

Am I supposed to use the "package" command or something?

I already made an ImageViewer.class file. It compiled properly and I'm
supposed to make use of that file to display images on this (Flags.java)
file.
 
V

Virgil Green

RayKnight said:
Flags.java.13: cannot find symbol
symbol: class ImageViewer
location: class Flags
ImageViewer imageviewer1 = new ImageViewer();

With two ^ point at the first and last ImageViewer.

Am I supposed to use the "package" command or something?

I already made an ImageViewer.class file. It compiled properly and I'm
supposed to make use of that file to display images on this
(Flags.java) file.

You might want to include some of the original message when replying. I just
*think* this might have been a response to a post of mine.

Anyway, based upon the error you quote above, it would appear that
ImageViewer is not found in your class path, or you have not imported it
correctly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top