Swing 面板/框架中的布局组件作为一个方面
我希望改进我们为 Swing 应用程序构建的框架。我想引入 Spring 并引入方面。我对 Spring 和方面都很陌生。我想知道,将组件布局作为一个方面是一个好的做法吗?例如:
下面是我在典型的 swing 面板中的类:
public class Panel extends JPanel{
public Panel(){
initComponents();
layoutComponents();
}
}
我想知道,是否删除对layoutComponents 的调用并将其应用为 spring 配置文件中的一个方面。有一个单独的类来执行“布局”并将其作为一个方面应用,而不是在 Panel 类中进行布局。这是使用方面的场景吗?
I was looking to better the framework that we had built for our Swing application. I wanted to bring in Spring and introduce aspects. I am new to both Spring and aspects. I was wondering, is it good practice to say layout the components as an aspect? For example:
The below is my class in a typical swing panel:
public class Panel extends JPanel{
public Panel(){
initComponents();
layoutComponents();
}
}
I was wondering, if I remove the call to layoutComponents and apply it as an aspect in the spring config file. Have a separate class that performs the 'layout-ing' and apply that as an aspect rather than do the layout in the Panel class. Is this the kind of scenario an aspect is used for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这没有用,因为方面与横切关注点相关,而在这里您试图在小部件本身内布置小部件的组件。那么交叉点在哪里呢?
I don't think this will be useful, since aspects are related to cross-cutting concerns, while here you are trying to lay out components of a widget within the widget itself. So where is the cross-cutting?