I have some problems facing with viewport
In AComponent has Viewport.
In Viewport BComponent is added with setViewedComponent(new BComponent()).
In BComponent’s resized() while i try to use getParentComponent(), there is component i can find here.
Can any one point, what is the problem ? Thank you.
BComponent doesn’t get added as a child component until it has finished being created. Remember that, effectively, in the line…
… the bit in the brackets is evaluated before the function call is actually made.
BComponent is therefore fully constructed before the Viewport gets a look at it (and so it doesn’t have a parent yet).