Java SE MVC implementation with Swing

后端 未结 2 1906
情歌与酒
情歌与酒 2020-12-18 14:22

I\'ve implemented MVC pattern for Java SE with Swing using PropertyChageSupport and PropertyChageListener. The diagram for implemented MVC is as fo

2条回答
  •  渐次进展
    2020-12-18 15:10

    First a caveat: I'm not a professional or student but a hobbiest, but having said that, my own preference is with your second example,

    btnOk.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            modelController.btnOkActionPerformed();
        }
    });
    

    The control would have to call methods on the view to extract information, and any methods it would call would be part of an interface that the view implements. My goal in this is to keep the view as dumb as possible and do almost anything to loosen coupling as much as possible.

提交回复
热议问题