Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unknown error, please help

Status
Not open for further replies.

coolskater49

Technical User
Nov 20, 2002
20
GB
hi,

when i try to compile and run my code i get the following errors -

"FruitMachine.java": cannot resolve symbol: method add (GamesLib.Reel)in class java.awt.Panel at line 54, column 16


this is the code -
Code:
Panel reelsPanel = new Panel();
    reelsPanel.setLayout(new GridLayout(1,3));
    reelsPanel.add(reel[0]);
    reelsPanel.add(reel[1]);
    reelsPanel.add(reel[2]);

The problem is with the "reelsPanel.add..." but i have code of the exact same format in a different project and that creates no errors.

Can anyone please help.

Thanks, Paul.
 
First of all: Use more specific Threadtitles. (Panel.add - error for instance).

Your reelsPanel seems to be a Panel - I guess a java.awt.Panel?

And perhaps the code, where the methods worked, this Panel wasn't just an awt.Panel, but a class derived from Panel.

Since we don't know what it is, a 'reel[0]', we may guess: If reel is an array of Button or Panel or Label, your code should work. But if a reel is something, not common to java.awt, I don't believe java.awt.Panel knows how to add it.

Is this hint worth a star?
 
The problem is about reel[0] and GamesLib.Reel, they should be subclass of java.awt.Component

The compiler sometimes tells you the error occurs at line 54, the error can appear just before line 54.

Please post the complete source code if you want everyone to help you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top