質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top