1

I am faced with the following situation: My GUI needs a Panel with some special methods (Adding a message to display, adding an image...).
Easy so far. Now, this element is supposed to be exchangeable from the outside!
One version has a pink background, one has a purple one, one is upside down, to name some random examples.
My basic idea was to define an abstract class extending JPanel, with the required methods defined as abstract methods as well.
The question that now keeps me stuck is: where do the implementations belong? I cannot have a jar implement an abstract class from the main apllication, and then have the application use that jar. That idea alone sounds totally broken!

So, how do I solve this properly? I feel like I am missing something obvious here...

EDIT: Plugin is the word I was missing! Marked this as duplicate, the linked answer tells me exactly what I was lookign for :)

Layna
  • 457
  • 5
  • 19
  • 2
    That depends on what you mean by "exchangeable from the outside". Would the "outside" just select from a defined number of variants or provide custom variants? If the latter would they just change in data (like color, orientation) or logic as well? If the latter again then using a plugin system of sorts would probably the way to go (and it's basically like what you described: the "outside" would provide a jar that the application is using). – Thomas Mar 15 '16 at 16:28
  • The logic woudl change as well... and PLUGIN, that is the word I may have been stupidly missing!!! – Layna Mar 15 '16 at 16:29

0 Answers0