Re: instance of classes
dendeezen wrote:
..
Several days ago I asked the same question .
It might have made more sense to continue the
discussion on that thread, but since this post has
all relevant information (though the question was
cleverly hidden!) I will continue it here.
..Hereby now some code ..
Self contained examples, no less! :-)
..to explain what I mean.
'Let the code do the talking'? I am comfortable
with that.
Thanks for helping a newbie,
Note that a good group for those starting Java
is comp.lang.java.help, this group is better suited
to folks that have more complex problems.
But to your code.
When compiling, I got the error 'cannot find symbol
symbol : constructor basis()' that confused me for
a few moments, as I expected it to get a 'default
constructor' but a bit of googling later suggested to me
that the default constructor is *only* created when
there are *no* other constructors defined - and the
basis class already had one that took three arguments.
The 'simplest solution' is to explicitly add a 'no args.'
constructor, but note that is *probably* not the entire
solution. The compilable form of the basis class, is
as follows..
<snippet>
class basis extends JPanel{
basis() {
}
basis(testinstance ti, beta be, geg ge) {
GridLayout grid = new GridLayout(3,0);
setLayout(grid);
geg g = new geg(ti, be);
beta b = new beta(ge);
this.add(g);
this.add(b);
}
}
</snippet>
HTH
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via http://www.javakb.com