I'm working a java+swing+miglayout project we settled on a class design for graphical classes that inherits from JPanel & JFrame, here is the skelletons :
class GammaFrame extends JFrame {
private JPanel __pane__ = null;
public static GammaFrame open(...) {
_instance = GammaFrame()
__pane__ = _instance.getContentPane();
__pane__.setLayout(new MigLayout(...));
_instance.__init__()
# do logic job if any
return _instance;
}
public static void main(String argv[]) {
GammaFrame.open();
}
}
class GammaPanel extends JPanel {
public static GammaPanel create(...) {
_instance = GammaPanel()
_instance.setLayout(new MigLayout(...));
_instance.__init__()
# do logic job if any
return _instance;
}
public static void main(String argv[]) {
JPanel panel = GammaPanel.create()
JFrame frame = new JFrame()
frame.getContentPane().add(panel)
#
# more settings here
#
frame.setVisible(true)
}
}
what may be the flaws of this design ?