File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Problem with package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Problem with package

Michail Petrov
Ranch Hand

Joined: Sep 04, 2008
Posts: 32

Problem newProblem = new Problem

This time is with the methods in diferent files

i have this two fils and i wont to use the method in the second file

but when i try to compile the cod the mashine say
CAN NOT FIND THE METHOD CreatePanel(Color.color);

I import everything why gives me the problem
everything is public
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
The CreatePanel(Color) method is not a static method. You have to have an instance of the Firma.Method class to invoke the CreatePanel().

Firma.Method method = new Firma.Method();
JPanel panel = method.CreatePanel(myColor);

P.S. The Java convention is to begin method names with a lower-case character, and package names are generally all lower-case.

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
By the way, in anticipation of your next possible question:

The squert variable on line 11 is not the same as the sqert instance variable on line 4, despite the fact that they have the same name and type.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46337
Michail Petrov wrote:Problem newProblem = new Problem
Compiler error: it should read

Problem newProblem = new Problem();

JavaRanch error: same question asked here. Please don't. Closing this thread.
I agree. Here's the link:
subject: Problem with package
It's not a secret anymore!