Layout components in a Swing Panel/Frame as an aspect
Question
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?
Solution
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?