• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Application Plugins

If I wanted to make an (Java) app that I wanted to be plugin compatable, how would I go about doing this?

The only way I can see to do this is:

-Have a plugin folder
-Get all the .class files in the folder and load them into an array within my main app
-Each plugin class would have a standard Construtor which took an instance of my main app
-Most of my program variables would need to be set to public - then the plugin classes could make changes how they wish (such as replace an actionListener on a JPanel etc)

Is this an acceptable method?

Thanks
 
Sounds good except for making program variables public, that's just a dangerous idea. Think about exactly what you need to allow a plugin to do and expose those ideas through interface methods, never anything more concrete. It'll bite you in the ass if you ever want to refactor.

I would prefer to not enforce any constructors except a no-arg and have an interface method called initialize() or something but it's not a big deal either way.
 
Back
Top