method for a class constructor
Hi guys,
As a novice, I can't find out (and believe me, I tried hard),how to
write the right method to construct a class.
Hereby a SSCCE, I guess this is the best way to explain what I mean.
<code>
public class test extends JFrame{
alfa alf;
beta bet;
gamma gam;
public test () {
alfa alf = new alfa(this,null);
beta bet = new beta(this,null,null);
gamma gam = new gamma(this,null);
alfa.setbeta(bet);
bet.setalpha(alf);
bet.setgamma(gam);
gam.setbeta(bet);
<stuff>
}
}
class alfa extends JPanel implements ActionListener {
test ti;
beta bet;
public alfa (test ti, beta bet) {
//??
public void setbeta( <stuff>) {
<stuff>
}
this.ti = ti;
this.bet = bet;
<stuff>
}
}
class beta extends JPanel implements ActionListener{
test ti;
alfa alf;
gamma gam;
public beta(test ti,alfa alf, gamma gam) {
//??
public void setalfa(<stuff>) {
<stuff>
}
//??
public void setgamma(<stuff>) {
<stuff>
}
this.gam = gam;
this.ti = ti;
this.alf=alf;
<stuff>
}
}
class gamma extends JPanel {
test ti;
beta bet;
public gamma(test ti, beta bet) {
//??
public void setbeta(<stuff>) {
<stuff>
}
this.ti=ti;
this.bet=bet;
<stuff>
}
}
</code>
Tanks,