I'm trying to code an interface with a method that returns a subtype of a JComponent. Depending which class I implement this interface, I want it to return a JPanel, a JLabel or any other subclass of JComponent.
I thought in generics to solve my problem and I try the code above, but it won't work. I would like to know why and a possible solution.