How to use Guice in Swing application

旧时模样 提交于 2019-12-01 04:20:51

Could you use Multibinding to bind all of your tabs as a Set? If they implemented some interface that allowed you to get the name to use for the tab, you could then just loop through adding the tabs from the set. You'd probably need to figure something out as far as ordering the tabs though.

Couldn't you just inject the service in the JFrame and let the tabs ask for the service / configuration, like so

this.getTopLevelAncestor().getService()

Of course this only works if called after they have been added to a container.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!