Win a copy of Functional Reactive Programming this week in the Other Languages forum!
    Bookmark Topic Watch Topic
  • New Topic

Problem with package

 
Michail Petrov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 1296
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 50196
79
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic