[Solved] How to access and change the instance variables created within a superconstructor?


JLabel is a subclass of JContainer. JContainer offers a public method named setFont(), so you can call it from any place in your program, where you have a reference to the label object (the Lives’ constructor is a valid place though).

The possbility to change a super class’ attribute depends on its visibilty (for example protected) and available accessor methods (for example getName() and setName() ).

If an attribute/accessor was declared public or protected, you can change it directly from inside the subclass. In case of default visibilty, the subclass needs to be in the same package as the super class to manipulate the respective attribute.

solved How to access and change the instance variables created within a superconstructor?