package portale.interfaccia;
public class PageIndex extends FlowPanel {
protected Integer prova;
private PageCenter center;
public PageIndex() {
this.center=new PageCenter();
this.add(center);
}
}
package portale.interfaccia;
public class PageCenter extends FlowPanel {
public PageCenter() {
super.prova=2;
}
}
why, if prova is protected, i can’t access to it by using super?
Cheers
PageCenter extends from FlowPanel, not from PageIndex. It looks like
FlowPanelhas no attribute namedprovaIf you want
PageCenterto access a protected attribute fromPageIndexusing thesuperkeyword, then you should extend fromPageIndex.If you want both classes to extend from
FlowPanel, try refactoring your code so thatPageIndexandPageCenterknow some utility class.Then you could use it like this:
If passing this reference around doesn’t make it for you, try using a Singleton
Then call it by:
ProvaInstance.getInstance().getProva()