Implementation of observer pattern does not require that you extends your new JPanel class. You should to define the interface(s) and implement that/those interface(s) in your class.
I recommend to you take a look on this.
JPanel Observer
-
30-08-2022 - |
Pergunta
I created a game in a separate panel class from the GUI main class. I am trying to find a way to update the score and level text fields found inside the GUI main class, when a method inside the panel class is executed. I tried to use the observer design pattern but the panel class already extends JPanel
and can only extend one item. Is there an alternative to this?
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow