Hey guys; I have trolled this forum a bunch. Love it. First time posting though.
I have an interface that I am using for some Frames that I am using. I declare the components (Jbuttons, Jlabels etc) in the interface. Works great for the first Class that implements the interface; however the 2nd class that implements the interface retains the values of the first class assigned to the components. (And vice versa depending on which class is called first). I am coming to understand that variables and components declared in an interface are really one entity and not a fresh copy each time you implement the interface.
Would it be better then to just have a container class that stores the components and instantiate that for the components? And then keep the interface for my abstract methods.
Just want to make sure I am thinking about this right and implementing the correct solution.
"The greatest of all weaknesses is the fear of appearing weak." - JB Bossuet
Every field declaration in the body of an interface is implicitly public, static, and final.
If you have a lot of GUI classes that share some commonality, you could design that common portion as a separate class and incorporate an instance of that class in each separate GUI (favor composition over inheritance).
There are no new questions, but there may be new answers.