我们可以在同一应用程序的其他实例中重用Java Swing应用程序组件吗? [英] Can we reuse Java Swing application components in other instances of same application?

查看:155
本文介绍了我们可以在同一应用程序的其他实例中重用Java Swing应用程序组件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Java Swing应用程序,其中包含JTable,JCombobox,JTextArea和许多其他Swing组件等组件。



现在有一个要求说我们需要创建多个屏幕/复制相同的Java Swing应用程序。例如如果我的主要Java Swing应用程序是X,那么我必须创建与X相同的应用程序A,B,C,D ...。



所以这里有一些明显的设计限制,我们不应该多次创建X应用程序。我们应该创建一次,并利用它们来创建其他应用程序A,B,C,D ....



这里有一个问题,这些A,B,C ...应用程序可能是或可能不是X的子集。这意味着A具有较少的Swing组件,然后X。



有一种方式存储类文件并创建应用程序,但是Swing组件如何重用它们?我们可以在哪里存储?



这是一种设计问题。任何想法..

解决方案

我认为你最好的办法是设计你的应用程序,出来所以,一个插件/模块类的架构最适合这里。您可以设计您的组件模块,如果应用程序需要它将其安装为插件,如果不需要它,则不要安装它,如果现在不需要它,请卸载它。就像我们的IDE一样,像Netbeans,Eclipse,IntelliJ。



由于这是一个Swing应用程序,我强烈建议您查看 Netbeans Platform


We have a Java Swing application which contains components like JTable, JCombobox, JTextArea and lots of other Swing components.

Now there is a requirement that says we need to create multiple screens/copy of same Java Swing applications. For e.g. if my main Java Swing application is X then I have to create same applications A,B,C,D,... same as X.

So here there are some obvious design constraints that we should not create X applications many times. We should create it only once and utilize them to create other apps A,B,C,D....

There is a problem here these A,B,C... applications may be or may not be subsets of X. It means that A is having less Swing components then X.

There is one way store class files and create app from it but what about Swing components how do we reuse them? Where can we store them?

This is kind of design question. Any ideas..

解决方案

I think the best you can do is, design your application in a way that you can plug things in and out. So, a plugin/module kind of architecture best suits here. You can design your components module based, if application needs it install that as a plugin, if doesn't need it don't install it, if doesn't need it now, uninstall it. Just like we do with our IDEs, like Netbeans, Eclipse, IntelliJ.

As this is a Swing application, I would strongly recommend looking into Netbeans Platform.

这篇关于我们可以在同一应用程序的其他实例中重用Java Swing应用程序组件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆