• Post Reply Bookmark Topic Watch Topic
  • New Topic

get.contentpane() error  RSS feed

 
Ian Cockcroft
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
I am using a class created by a collegue called Picture, unfortunately he is no longer around.
the class looks as follows:

I am using it in the following code:


I get an error when I try add the pic to my content pane.
Any ideas why?
The jpg is in the same folder as Picture class.
Some code would be most helpfull.
Thanks alot.
Ian
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the error message?
 
Ian Cockcroft
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mmmmm, clever me.
It was commented out.
Its a cannot resolve sybol error.
on the line of code :
myFrame.getContentPane().add(pic,
BorderLayout.CENTER);
Thanks Dirk
Ian
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which symbol does the error message point to with its little ^ ?
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a Swing error so I am moving this to the Swing forum.
 
Ian Cockcroft
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it looks something like this
symbol: method add
(HelpScreens.Picture,java.lang.String)
location: class.awt.Container
myFrame.getContentPane().add(pic, Border..

It wont put it in the right place, but its under the opening bracket of the getContentPAne() method.
Your patience is greatly appretiated.
Thanks
Ian
[ June 12, 2002: Message edited by: Ian Cockcroft ]
[ June 12, 2002: Message edited by: Ian Cockcroft ]
[ June 12, 2002: Message edited by: Ian Cockcroft ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It wont put it in the right place
If you were to surround the text with the [code] and [/code] UBB tags, then the formatting would be preserved.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Much of this information was quickly gathered from The API Documentation.
JFrame::getContentPane() returns a Container object.
A Container object has six methods named add available to it - five in its own class definition and one inherited from its parent class Component.
You are proposing to pass a Picture object and a String object to some method called add of the Container type object.
The Picture class extends directly from Object (as no other lineage was specified in its class description).
No method named add available to a Container object takes a Picture object (or an Object object) and a String object. That is why the compiler is telling you that the method does not exist - because it does not exist.
Is this making sense? Are you getting any ideas?
[ June 12, 2002: Message edited by: Dirk Schreckmann ]
 
Ian Cockcroft
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dirk, that does make a lot more sense.
I'm thinking, i need to change Picture class to inherite from Image?
I will play arouond with it and let you know wat I get.
Thanks again
Regards
Ian
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!