wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Problem with package

Michail Petrov
Ranch Hand

Joined: Sep 04, 2008
Posts: 32
Hi

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
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
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: http://aspose.com/file-tools
 
subject: Problem with package
 
Similar Threads
How to Resize JScrollPane used in a JPanel?
JTable serialization problem
About "Button Size"
Haw to separate a frame to diferent fraims
JTabbedPane