What is the import for a Layer

C

clusardi2k

I've got a project that doesn't reconize "Layer". Is there something that I can try importing to get past this error.

Thanks,
 
A

Arne Vajh?j

I've got a project that doesn't reconize "Layer". Is there something that I can try importing to get past this error.

There may be many Layer classes out there.

One is org.jfree.ui.Layer.

You IDE should be able to suggest something.

Arne
 
A

Arved Sandstrom

There may be many Layer classes out there.

One is org.jfree.ui.Layer.

You IDE should be able to suggest something.

Arne
Also, is there a fully-qualified import statement already in the source
file, for a Layer class or interface? If not, what is the package of the
class that needs Layer? These are ways of identifying what Layer is
required, that and looking at the source to see what kinds of methods
are invoked on Layer objects, and matching that with APIs you discover
by Googling.

It's not a safe attitude to "get past" errors, not with imports nor
anything else. And even if you've got a number of libraries that supply
class X, and you can successfully compile with several, only one may be
correct at runtime. Don't rely on your IDE to make the right suggestion,
it can only know the possibilities: you yourself must know what you need.

AHS
 
L

Lew

I've got a project that doesn't reconize "Layer". Is there something that I can try importing to get past this error.

Yes.

But you need to provide complete information. What do you mean the 'project ... doesn't
recognize "Layer"'?

How do you know?

What is 'Layer'? Is it a type? What package is it in? What JAR?

You need either to fully qualify the type name or import that type according to the standard,
basic, fundamental use of 'import', which would have been one of the earliest things you would
have learned in Java.

So if the package is, for example, 'com.example.foo.layer', and 'Layer' is a type within that
package, you would refer to 'Layer' in source either as
'com.example.foo.layer.Layer'
or use 'import' to allow you to use the simple type name elsewhere in your source module

import com.example.foo.layer.Layer;

public class YourClass
{
. . .
Bar kabar = new Layer().framitz();
. . .
}

But you really have to explain what you mean and be precise about what you observe (such
as error messages, etc.) to give anyone enough information to help you. Consider studying

http://sscce.org/

and providing one.
 
J

John B. Matthews

Arne Vajhøj said:
There may be many Layer classes out there.

One is org.jfree.ui.Layer.

Good call. JFreeChart requires the JCommon class library, a separate
 

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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,187
Latest member
RosaDemko

Latest Threads

Top